home *** CD-ROM | disk | FTP | other *** search
- <HTML>
- <HEAD>
- <TITLE>Handling mouseOver and mouseOut Events</TITLE>
-
- <SCRIPT>
- function highlight(callingElement)
- {
- if (!callingElement.contains(event.fromElement))
- callingElement.style.backgroundColor = "yellow";
- }
-
- function unhighlight(callingElement)
- {
- if (!callingElement.contains(event.toElement))
- callingElement.style.backgroundColor = "white";
- }
- </SCRIPT>
- </HEAD>
-
- <BODY BGCOLOR=white>
- <P ID=text onMouseOver="highlight(this);" onMouseOut="unhighlight(this);">
- When the cursor moves from normal text within a paragraph to
- <B>bold text</B>, a <TT>mouseOut</TT> event is generated by the
- <TT>P</TT> element and a <TT>mouseOver</TT> event is generated by
- the <TT>B</TT> element. This causes the paragraph highlighting to
- blink. The cursor, however, has not moved out of the boundaries
- of the <TT>P</TT> element, simply onto one of its child elements.
- </P>
- </BODY>
- </HTML>
-