asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Dynamic HTML > Handling Events

Dynamic HTML

Previous: Understanding Events   Next: Event Bubbling


Declare event code for a specific element

In Internet Explorer®, we can declare event handling code and use the for and event attributes of the SCRIPT element to associate the code with the event.

The following example defines JavaScript code and associates it as the onmouseover event handler for the IMG element having the identifier theImg.

<script language="JavaScript"
   for=theImg
   event=onmouseover>
   ... JavaScript code ...
</script>

<img id="theImg" src="sample.gif">

Notice that in this case, there is no call to the onmouseover event handler of the object itself. It is declared in the event attribute of the SCRIPT tag.

More ...
Back to top

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note