HighDots Forums  

onClick event problem

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss onClick event problem in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Magician
 
Posts: n/a

Default 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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.