January 4, 2001 - The Netscape 6 Event Object
January 4, 2001 The Netscape 6 Event Object Tips: January 2001
Yehuda Shiran, Ph.D.
|
e
object holds a lot of information about the Netscape 6 event. The type
property, for example, reveals the event type. For example: "mouseover"
and "mouseout"
. The following statement prints the event type in the status window:
window.status = e.type;
The status window is shown on the bottom left corner of Netscape 6 window. Notice that you have to pass the e
object as a parameter to those functions which reference it. In the following example, we pass the e
object as a parameter to colorItYellow()
and colorItTan()
:
<DIV ID="demoDiv" STYLE="position:relative; left:100px; top:20px; width:120px;
height:25px; color:blue; background-color:yellow;">Mouse over me!</DIV>
<SCRIPT LANGUAGE="JavaScript">
<!--
var demoObj;
function init() {
demoObj = document.getElementById("demoDiv");
demoObj.addEventListener("mouseover", colorItTan, false);
demoObj.addEventListener("mouseout", colorItYellow, false);
}
function colorItTan(e) {
demoObj.style.backgroundColor = "tan";
window.status = e.type;
}
function colorItYellow(e) {
demoObj.style.backgroundColor = "yellow";
window.status = e.type;
}
onload = init;
// -->
</SCRIPT>
Get on Netscape 6 browser and play with this demo.