Using Event Bubbling with the onClick Event : HTML Body Event « HTML « JavaScript DHTML






Using Event Bubbling with the onClick Event

<HTML>
<HEAD>
<TITLE>Using Event Bubbling</TITLE>
<SCRIPT><!--
function buttonClickHandler() {
 alert("The onClick event was handled by buttonClickHandler()")
}
function formClickHandler() {
 alert("The onClick event was handled by formClickHandler()")
}
function documentClickHandler() {
 alert("The onClick event was handled by documentClickHandler()")
}
//--></SCRIPT>
</HEAD>
<BODY ONCLICK="documentClickHandler()">
<H1>Using Event Bubbling</H1>
<FORM ONCLICK="formClickHandler()">
<INPUT TYPE="BUTTON" ONCLICK="buttonClickHandler()" VALUE="Click here!">
</FORM>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Using the fireEvent() Method
2. onBlur and onFocus Event Handlers
3.Using the onSelectStart Event Handler
4.Calling to Display the Alert Dialog onLoad
5.Calling to Display the Alert Dialog Directly
6.JavaScript Event Handlers :Loading/ Unloading a Document
7.Handling Load Events in a Content Document
8. Running a Script from the onLoad Event Handler
9.Using addBehavior() and removeBehavior()