Can anyone help me understand why the checkMajor() function (at the
very bottom of this script) is not being executed after the if/else
statement? The function just seems to die after successfully executing
the if/else.
Thanks,
Rob
<script type="text/javascript">
var ssArray = new Array();
function readCookie()
{
for ( var i=801; i <= 900; i++ )
{
ssArray.push( document.getElementById("ss"+i) );
}
for (var i = 0; i < ssArray.length - 1; i++)
{
var the_cookie = document.cookie;
the_cookie = decodeURIComponent(the_cookie);
if ( the_cookie.match( ssArray[i].id + "=c" ) )
document.getElementById(ssArray[i].id).src = "ls_files/
done.gif";
else
document.getElementById(ssArray[i].id).src = "ls_files/
not_done.gif";
}
checkMajor();
}
</script>
I figured out the problem. Some elements in my array were not defined,
so before pushing them onto the array, I just had to add a line to
test whether they were defined:
<snip>
if (document.getElementById("ss"+i));
ssArray.push( document.getElementById("ss"+i) );
</snip>
Thanks for the idea about the error console. Found a cool shortcut to
access it (called the JavaScript console) in Firefox:
chrome://global/content/console.xul