Which element was clicked : Mouse Event : Event JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Event » Mouse Event »

 

Which element was clicked



<html>
<head>
<script type="text/javascript">
function whichElement(event){
    var tname
    tname=event.srcElement.tagName
    alert("You clicked on a " + tname + " element.")
}
</script>
</head>

<body onmousedown="whichElement(event)">
<p>Click in the document. </p>

<h3>This is a header</h3>
<p>This is a paragraph</p>
<img border="0" src="http://www.navioo.com/style/logo.htm" 
    width="50" height="50" alt="Ball">
</body>

</html>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Event
» Mouse Event