abdelelbouhy Posted July 4, 2009 Share Posted July 4, 2009 hello guys i'm trying to create image gallery but i found a problem with the event handeler from the external file it doesn't work all the script is working but when i try to include the eventhandler within the script it doesn't work if you please helpwindow.onload = prepare;function prepare(){var target = document.getElementById("imagegallery");var lin = target.getElementsByTagName("a");for(i = 0; i < lin.length; i++){lin.onClick = function(){return showPic(this);}}}function showPic(whichPic){var placeHolder = document.getElementById("holder");var source = whichPic.getAttribute("href");placeHolder.setAttribute("src",source);var oldText = document.getElementById("text1");var textSource = whichPic.getAttribute("title");oldText.firstChild.nodeValue = textSource;return false;} Link to comment Share on other sites More sharing options...
Ingolme Posted July 5, 2009 Share Posted July 5, 2009 The correct way to use events is to have the whole event name in lowercase:lin.onclick Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.