Originally Posted by
tefflox
Thanks, Hielo.. I did tinker with firebug last night, after fixing a few things, but could not find where the errors would be displayed.
Once firebug is installed, you will see a little icon on the lower right-hand side of your browser. The icon will be a small check mark on a green background if there are no reported errors on the page, or an x on a red background if errors exist. However, you still need to configure it for it to show the "x" icon upon javascript errors. To do so, click on the icon > options > Show Javascript Errors
I'm kind of in the dark as to the cover (URI) page, tho I suspect it may be something to do with running these functions concurrently:
setInterval("alterText();", 110);
setInterval("alter();", 100);
setInterval("alter();", 100);
When I looked at this page, nothing had changed. You were not checking for the limit (23).
Actually, I counted 24 letters in liste v nligh v tpoet v ryjou v rnal iv
Yes, this is correct. But you began numbering the letters at 0. So, the 24th letter will have id "n23". So, when you add a limit check to it, you cannot exceed 23. Refer to my previous post to see how I addressed this issue on the other page.
-- & since, to my knowledge, employing Math.floor() requires it, I changed the delimiting constant herewith from 24 to 25:
Math.random() by itself will give you a floating number that will be at least 0 and a number that is "almost 1". When you multiply that number by 24, you end up with a number that is at least 0 and "almost 24" (perhaps 23.99999999999999999999999999999999). Then Math.floor() basically just keeps the integer part, and hence, your number range will be [0, 23]. That's why alter will never trigger any errors on that page, since your letters are labeled from id="n0" ... id="n23".
function alter() {
i = "n" + Math.floor(Math.random() * 25);
document.getElementById(i).style.color=genHex();
}
Again, that 25 should be changed back to 24. Otherwise you will start getting errors triggered by alter() as well, since 25 changes the possible ids to [0,24], but there is no id="n24".
These changes are live: http://listenlight.net. I am marking the problem solved. If you will, please confirm that it functions in IE without errors.
The errors are still there. Your functions should be changed to:
function alter() {
i = "n" + Math.floor(Math.random() * 24);
document.getElementById(i).style.color=genHex();
}
var letter = 0;
function alterText()
{
if(letter < 24)
{
underscore = document.getElementById("n" + letter).innerHTML;
if(underscore == "_")
{
document.getElementById("n" + letter).innerHTML=" ";
}
else
{
document.getElementById("n" + letter).style.visibility="visible";
document.getElementById("n" + letter++).style.color=genHex();
}
return true;
}
return false;
}