Click to See Complete Forum and Search --> : onClick of menu item triggered at load??


sneakyimp
01-08-2008, 01:16 AM
I have been working on a Javascript menu class for hours now and for some reason the onClick event of the first menu item is being triggered when the page loads. I have attached a zip file containing the script. If you open the index.html file, the browser will immediately load the link associated with the first menu item.

I have noticed that merely assigning my menuOnClick function to the Menu object's onClick event is enough to cause the problem.

I've also noticed that if I change the case of onClick in this line:
Menu.prototype.onClick = menuOnClick;

to this:
Menu.prototype.onclick = menuOnClick;

Then the onClick event is not triggered. I have no idea if the script will work with that change, however. I'm still debugging the script.

Any help would be MUCH appreciated.