// Copyright  2001 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.

<HTML>
<HEAD>
<TITLE>Cross-Browser Events I</TITLE>
<STYLE TYPE="text/css">
BODY {background-color:white}
.normal {font-weight:normal; background-color:white}
.highlight {font-weight:bold; background-color:yellow}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function toggleHighlight(evt) {
    evt = (evt) ? evt : ((window.event) ? window.event : "")
    if (evt) {
        var elem = (evt.target) ? evt.target : evt.srcElement
        elem.className = (evt.type == "mouseover") ? "highlight" : "normal"
    }
}

function init() {
    var elem
    if (document.all) {
        elem = document.all.mySPAN
    } else if (document.getElementById) {
        elem = document.getElementById("mySPAN")
    }
    // assign event handlers for modern DOM browsers
    if (elem) {
        elem.onmouseover = toggleHighlight
        elem.onmouseout = toggleHighlight
    }
}
</SCRIPT>
</HEAD>

<BODY onLoad="init()">
Roll the mouse to find the <SPAN ID="mySPAN" CLASS="normal">active section</SPAN> 
of this sentence.
<HR>
</BODY>
</HTML>