Using the onSelectStart Event Handler : HTML Body Event « HTML « JavaScript DHTML






Using the onSelectStart Event Handler


/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/


<HTML>
<HEAD>
<TITLE>onSelectStart Event Handler</TITLE>
<STYLE TYPE="text/css">
TD {text-align:center}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function showObj() {
    var objID = event.srcElement.id
    status = "Selection started with object: " + objID
}
</SCRIPT>
</HEAD>
<BODY ID="myBody" onSelectStart="showObj()">
<H1 ID="myH1">onSelectStart Event Handler</H1>
<HR ID="myHR">
<P ID="myP">This is a sample paragraph.</P>
<TABLE BORDER="1">
<TR ID="row1">
    <TH ID="header1">Column A</TH>
    <TH ID="header2">Column B</TH>
    <TH ID="header3">Column C</TH>
</TR>
<TR ID="row2">
    <TD ID="cellA2">text</TD>
    <TD ID="cellB2">text</TD>
    <TD ID="cellC2">text</TD>
</TR>
<TR ID="row3">
    <TD ID="cellA3">text</TD>
    <TD ID="cellB3">text</TD>
    <TD ID="cellC3">text</TD>
</TR>
</TABLE>
</BODY>
</HTML>

           
       








Related examples in the same category

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