HTML and CSS Reference
In-Depth Information
Figure 2.8: HTML page with a floating table element
Another class of HTML global attributes is used to specify what actions
browsers should take when the user interacts with an element. hese event
handlers take as their values one or more JavaScript statements. Typically, the
value consists of a call to a JavaScript function deined in the document's head
or in an external ile, and this function does all the work. For example, if you
had an input form on a web page that requested the user's email address, you
might add the onchange attribute to call a function that checks that the input
represents a valid email address. he HTML element would look like this:
<input type="text" onchange="check_email_address(this.value);"/>
In the late twentieth century, web developers built dynamic web pages
using these event handlers and a lot of JavaScript code. hese techniques were
referred to as dynamic HTML or dhtml , although that term had no oicial
standing. Modern web development practice discourages the addition of event
handler attributes to HTML elements and encourages the practice of writing
functions to handle events on DOM objects separately from the HTML source.
Because the use of these attributes is discouraged, they are listed without any
description, but the explanation of each is generally obvious from the attribute
name. Although these attributes can be used in any HTML element, they do not
make sense with every element. Here are the more commonly used attributes:
Search WWH ::

Custom Search