Arrow_onmouseover is attached with the ‘onmouseover’ event of an object. I get a ‘timeline is not defined’ JS error when the onmouseover event occurs. I know this relates to the variable scope. How can I correct this.
function startloop()
{
var changer = setInterval("changecontents();", 2000);
var timeline = setInterval("change();", 2000);
}
window.onload = startloop();
function arrow_onmouseover()
{
window.clearInterval(timeline);
window.clearInterval(changer);
}
Also what is the difference between a function called as Function(); and Function; . I believe this may also be relevant here since it greatly affects the scope of a variable.
ie what is the difference between
onclick="js();" and onclick="js;" or onclick="js"
where JS is a defined Java Script function.
Change your code like this.
The difference between
if your js function doesn’t have any parameters to receive you can simple avoid () like if you want to get the date you can call new Date(); but instead you can simply call new Date;