onClick event problem -
12-25-2006
, 06:49 PM
Hello.
I am trying to set the onclick event for images through a function, but the
event is triggered as soon the page loads, then will not work when the image
is clicked. Can anyone suggest what is wrong?
I am using IE6 for testing.
---------------------------------------------------------------------------
window.onload = fnNewWindowLinks;
function fnNewWindowLinks() {
for (var intLinks=0; intLinks<document.links.length; intLinks++) {
if (document.links[intLinks].className == "picture") {
document.links[intLinks].onClick = alert("Clicked");
}
}
}
---------------------------------------------------------------------------
Regards |