16.1 The onChange Event
The onChange event occurs when the users alter the input into form elements, such as a text box. In the following example, we shall show you how this event triggers a pop-up message when the user enters something into a textbox and alter its content.
Click on Example 16.1 to see the output.
When the user loads the web page that contains the script, a text box will appear at the top of the web page. When enters something into the textbox, alters it and then click outside the textbook, he will see a pop-up dialog then reads “You have changed the content”
16.2 The onSelect Event
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
yourtext = document.selection.createRange().text;
window.alert(“You text you have selected is: “+yourtext );
<textarea rows=”5″ cols=”20” onSelect=(SelText(this.form))></textarea>
Please click on Example 16.2 to test the output.