<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.java2s.com/style/logo.htm"
width="50" height="50" alt="Ball">
</body>
</html>