Allowing Events to Work for You

Now that you know how to reference any object on a page, you can now learn how to use events to run your scripts. This is crucial, because it is the events that will trigger the scripts to make your dynamic page changes for you. In order to add an event to an element on your page, you will need to set the event handler for that element.

In order to attach an event to an element, add the event as an attribute of the element:

<ElementName LANGUAGE=javascript EventName=EventHandler>

ElementName refers to any valid HTML element, such as a button (<INPUT> tag) or a paragraph (<P> tag). The script language is set to JavaScript with the LANGUAGE attribute. Event names correspond to any valid event that that element ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.