mitchpowell
07-30-2003, 01:26 PM
I have a motivational quote file that works fine with about 90 quotes, but something goes wrong after I try to add a few more quotes, and no quote shows at all when it's called.
The array is in an external file. Like this:
var quotes=new Array();
quotes[0]='This is a quote.<P ALIGN="RIGHT"><i>- author of quote</i></P>'
quotes[1]='This is a quote.<P ALIGN="RIGHT"><i>- author of quote</i></P>'
quotes[2]='etc...'
And at the end of all the quotes in the same external file is this command:
var whichquote=Math.floor(Math.random()*(quotes.length));
Then to call the quotes into my document, I use:
<SCRIPT TYPE="TEXT/JAVASCRIPT", SRC="js/externalquotesfile.js"></SCRIPT> in the head, and
<SCRIPT>document.write(quotes[whichquote]);</SCRIPT> in the body.
So when I try to add quotes[91] and beyond, it stops working. Why is this? I tested a bunch of very short quotes without much punctuation at the end, and they worked. I was able to get the quotes when all they said was: This is the 91st quote, and This is the 95th quote, and so on, but somewhere in the last quotes the punctuation seems to crash the whole thing.
The array is in an external file. Like this:
var quotes=new Array();
quotes[0]='This is a quote.<P ALIGN="RIGHT"><i>- author of quote</i></P>'
quotes[1]='This is a quote.<P ALIGN="RIGHT"><i>- author of quote</i></P>'
quotes[2]='etc...'
And at the end of all the quotes in the same external file is this command:
var whichquote=Math.floor(Math.random()*(quotes.length));
Then to call the quotes into my document, I use:
<SCRIPT TYPE="TEXT/JAVASCRIPT", SRC="js/externalquotesfile.js"></SCRIPT> in the head, and
<SCRIPT>document.write(quotes[whichquote]);</SCRIPT> in the body.
So when I try to add quotes[91] and beyond, it stops working. Why is this? I tested a bunch of very short quotes without much punctuation at the end, and they worked. I was able to get the quotes when all they said was: This is the 91st quote, and This is the 95th quote, and so on, but somewhere in the last quotes the punctuation seems to crash the whole thing.