Why is onClick Firing Immediately?
Hello there.
This is baffling me. I haven't done any Javascript in quite awhile, but I know this is supposed to work. Somehow it isn't;
HTML Code:
window.onload = function()
{
document.getElementById('Track01_Bubble01').onclick = myFunction();
}
Code:
function myFunction()
{
alert('Hello World!');
}
Somehow the function is being triggered as soon as the page loads, and it's not when I click on 'Track01_Bubble01'.
Does anyone see anything that I'm missing? I'm totally stuck.