nealbo
08-31-2003, 06:08 AM
Ok, lavalamp gave me this script to make a random quote generator. It works great, but I can't manage to figure out how to put a page break within a quote. i.e for a quote to look like this:
Quote line 1
Quote line 2
when I try this I get errors and when I try <br> I get the br showing up in the quote. How could i achieve this?
<html>
<head>
<title>Random Quotation</title>
<script type="text/javascript"><!--
var quotation=new Array();
quotation[0]="An eye for an eye, a tooth for a tooth.";
quotation[1]="Never drink yello snow.";
quotation[2]="Lavalamp is great!";
function randq(){
document.getElementById("hi").replaceChild(document.createTextNode(quotation[Math.round(Math.random()*(quotation.length-1))]), document.getElementById("hi").firstChild);}
//--></script>
</head>
<body onload="randq();">
<form>
<textarea rows="10" cols="50" id="hi">
Quote 1: An eye for an eye, a tooth for a tooth.
Quote 2: Never drink yello snow.
Quote 3: Lavalamp is great!
</textarea><!-- Enter some quotes in here in case the users don't have javascript enabled. -->
<br><br>
<input type="button" value="New Random Quotation" onclick="randq();">
</form>
</body>
</html>
please help...
Quote line 1
Quote line 2
when I try this I get errors and when I try <br> I get the br showing up in the quote. How could i achieve this?
<html>
<head>
<title>Random Quotation</title>
<script type="text/javascript"><!--
var quotation=new Array();
quotation[0]="An eye for an eye, a tooth for a tooth.";
quotation[1]="Never drink yello snow.";
quotation[2]="Lavalamp is great!";
function randq(){
document.getElementById("hi").replaceChild(document.createTextNode(quotation[Math.round(Math.random()*(quotation.length-1))]), document.getElementById("hi").firstChild);}
//--></script>
</head>
<body onload="randq();">
<form>
<textarea rows="10" cols="50" id="hi">
Quote 1: An eye for an eye, a tooth for a tooth.
Quote 2: Never drink yello snow.
Quote 3: Lavalamp is great!
</textarea><!-- Enter some quotes in here in case the users don't have javascript enabled. -->
<br><br>
<input type="button" value="New Random Quotation" onclick="randq();">
</form>
</body>
</html>
please help...