<html>
<head>
<title>Abakada DHTML Demo: onclick Event Handler Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="JavaScript">
function clickMe ( ) {
txtTag.value = window.event.srcElement.tagName;
txtType.value = window.event.srcElement.type;
/* This code determines whether the click occurred in an anchor,
and then cancels the event, preventing the jump. */
if ( window.event.srcElement.tagName == "A" ){
window.event.returnValue = false;
}
}
</script>
</head>
<body onclick="clickMe ( )">
<div class="header"><h2>Abakada DHTML Demo: <b>onclick Event Handler</b> Example</h2></div>
<hr size=1 width=92%>
<center>
<h4>This example tracks the event and triggers a function that returns<br>
the event's <b>srcElement</b> <i>tagName</i> and <i>type</i>, if applicable.</h4>
<p>Click on each of the following objects and anywhere else on this document<br>
and see what has been clicked. </p>
<div align="center">
<p><input value="Click me" onclick="clickMe ( )">
<input type="button" value="Click me" onclick="clickMe ( )">
<a href="" onclick="clickMe ( )">Click me</a></p>
<p>What's been clicked: </p>
<p><input id="txtTag" name="txtTag"> <input id="txtType" name="txtType"></p>
</center>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>