Event Handlers in Internet Explorer 4.0
In Internet Explorer 4.0, the number of event-generating HTML elements have been greatly expanded. Previously, only a small set of HTML elements could generate events: anchors, image maps, form elements, applets, and objects. With Internet Explorer 4.0, every HTML element on a page can generate a full set of mouse and keyboard events. For example, each element on a page features an
onMouseOver event handler. Keep in mind that Netscape Navigator 4.0x does not support this feature, so people using that browser cannot benefit from it. However, why not let Explorer 4.0 users enjoy the power of their browser? Here is a set of common events that every HTML element generates in Internet Explorer 4.0:
For more details on new event handlers in Internet Explorer 4.0x, be sure to look at Microsoft's official documentation.
onMouseOver, we put one in a standard
<FONT>...</FONT> definition, with no style add-ons. When you passed the mouse pointer over the surrounded text, the event was fired. We could have used any other set of HTML tags, including
<P>...</P>. Here's the exact code we used for the first sentence in this paragraph:
If you're viewing this page with Internet Explorer 4.0, pass the <FONT onMouseOver="alert('Isn\'t this surprising?')"> mouse over these words</FONT>.
Since other browsers (such as Netscape Navigator 4.0- and Microsoft Internet Explorer 3.0-) don't recognize the
onMouseOver event handler when placed in a
<FONT>...</FONT> definition, they simply ignore it, like any other unsupported HTML tag or attribute. Thus, users running such browsers are not adversely affected. This is definitely a win-win situation! You can provide special effects for those who are using Internet Explorer 4.0+, without penalizing others.
Created: October 9, 1997
Revised: December 4, 1997