<html>
<head>
<title>Page</title>
<script>
window.onload = function() {
var node = document.getElementById("testimage");
node.onclick=testFunction;
}
function testFunction(evt) {
if(evt)
alert("evt.target.id="+evt.target.id);
else //IE
alert("window.event.srcElement.id="+window.event.srcElement.id);
}
</script>
</head>
<body>
<img id="testimage" src='someimage.jpg'/>
</body>
</html>
No comments:
Post a Comment