[Javascript] js error in IE

Bob Schwartz bob at fotografics.it
Mon Mar 5 04:39:25 CST 2007


I am getting an error in IE in a js that seems to be working just  
fine in all other browsers.

MS script debugger says the error is here:

p.innerHTML = (quote[ry]);

in this script


window.onload = function() {
   random_content();
}

function random_content(){
var quote=new Array()
quote[1]='In Instanbul I met a man who said he knew beyond a doubt  
that God was a cat. I asked why he was so sure, and the man said,  
&quot;When I pray to him, he ignores <span class=lastword>me&quot;.</ 
span><br><cite class=right>Lowell Thomas</cite></p>'
quote[2]='Of all God&#8216;s creatures there is only one that cannot  
be made the slave of the lash. That one is the cat. If man could be  
crossed with a cat it would improve man, but it would deteriorate the  
<span class=lastword>cat.</span><br><cite class=right>Mark Twain</ 
cite></p>'
quote[3]='Cats seem to go on the principle that it never does any  
harm to ask for what you <span class=lastword>want.</span><br><cite  
class=right>Joseph Wood Krutch</cite></p>'
quote[4]='Cats exercise a magic influence upon highly developed men  
of intellect. This is why these long-tailed Graces of the animal  
kingdom, these adorable, scintillating electric batteries have been  
the favorite animal of a Mohammed, Cardinal Richlieu, Crebillon,  
Rousseau, <span class=lastword>Wieland.</span><br><cite  
class=right>Leopold Von Sacher-Masoch</cite></p>'
quote[5]='Nature breaks through the eyes of the <span  
class=lastword>cat.</span><br><cite class=right>Irish Proverb</cite>';

var ry=Math.floor(Math.random()*quote.length)
if (ry==0)
ry=1;
var p = document.createElement("p");
p.innerHTML = (quote[ry]);
document.getElementById("quotes").appendChild(p);
}


The test page is at:

http://www.fotografics.it/fife/wp/org/org_intro.html

to see a version with only the problem js active:

http://www.fotografics.it/fife/wp/org/quote.html

and

http://www.fotografics.it/fife/wp/org/quote2.html

(different load methods)

Any ideas?



More information about the Javascript mailing list