HTML and CSS Reference
In-Depth Information
Figure 13.18 Look at the status bar. You might have to enable the View Status Bar
feature for your browser.
13.6.5 Forms and the onChange Event Handler
The onChange event handler is triggered after the user modifies the value or contents of
an HTML input, select, or text area element in a form, and then releases the mouse. This
is another event handler that can be useful in checking or validating user input.
EXAMPLE 13.16
<html>
<head><title>onChange Event Handler</title></head>
<body>
1
<form>
Please enter your grade:
2
<input type="text" onChange="
grade=parseInt(this.value); // Convert to integer
3
if(grade < 0 || grade > 100){
alert('Please enter a grade between 0 and 100');
}
4
else{
confirm('Is '+ grade + ' correct?');
}
5
" />
6
</form>
</body>
</html>
 
 
Search WWH ::




Custom Search