I'm trying to display a random quote when the page is refreshed. Here is the code I have now:
<script language="JavaScript">
<!--- Hide from older browsers
function MQuote (Qnum) {
var Quotes=new Array();
Quotes[0]='"I smoke in moderation, only one cigar at a time."';
Quotes[1]='"Be careful of reading health books, you might die of a misprint."';
Quotes[2]='"Man is the only animal that blushes or needs to."';
Quotes[3]='"Clothes make the man. Naked people have little or no influence on society."';
Quotes[4]='"One of the most striking differences between a cat and a lie is that a cat has only nine lives."';
return Quotes[Qnum];
}
function RandInt (Size) {
var Rnum=Math.round(Math.random()*5);
return Rnum;
}
//Stop hiding -->
</script>
<body>
<!---Random Mark Twain Quote --->
<tr><td bgcolor="#FFFFCC" colspan="2" align="center">
<font color="brown" face="Arial, Helvetica, Sans Serif" size="2">
<script language="JavaScript">
<!--- Hide from older browsers
var RandValue=RandInt(4);
var QuoteText=MQuote(RandValue);
document.write("+QuoteText+");
// Stop hiding --->
</script>
The only thing that displays is +QuoteText+
Can someone tell me where my mistake is? I can't change the code too much because this is for a class I'm taking, but no one else can figure it out either.
<script language="JavaScript">
<!--- Hide from older browsers
function MQuote (Qnum) {
var Quotes=new Array();
Quotes[0]='"I smoke in moderation, only one cigar at a time."';
Quotes[1]='"Be careful of reading health books, you might die of a misprint."';
Quotes[2]='"Man is the only animal that blushes or needs to."';
Quotes[3]='"Clothes make the man. Naked people have little or no influence on society."';
Quotes[4]='"One of the most striking differences between a cat and a lie is that a cat has only nine lives."';
return Quotes[Qnum];
}
function RandInt (Size) {
var Rnum=Math.round(Math.random()*5);
return Rnum;
}
//Stop hiding -->
</script>
<body>
<!---Random Mark Twain Quote --->
<tr><td bgcolor="#FFFFCC" colspan="2" align="center">
<font color="brown" face="Arial, Helvetica, Sans Serif" size="2">
<script language="JavaScript">
<!--- Hide from older browsers
var RandValue=RandInt(4);
var QuoteText=MQuote(RandValue);
document.write("+QuoteText+");
// Stop hiding --->
</script>
The only thing that displays is +QuoteText+
Can someone tell me where my mistake is? I can't change the code too much because this is for a class I'm taking, but no one else can figure it out either.