EXERCISES


1:

Create three buttons , labeled Shoot movies, Shoot guns , and Shoot basketballs . When the user presses any button, use the onClick event handler to call a function that will send a message based on which button was pressed.

2:

Rewrite Example 12.19 to create a JavaScript function that will test for the browser type and handle the event.

3:

Create a form that contains a two text fields to receive the user's name and address, respectively. When the user leaves each text field, use the onBlur event handler to check if the user entered anything in the respective field. If he didn't, send him an alert telling him so, and use the focus() method to return focus back to the text field he just left.

4:

Create a form that will contain a text box. When the user enters text, all the letters will be converted to lowercase as soon as he clicks anywhere else in the form. (Use the onChange event handler.)




JavaScript by Example
JavaScript by Example (2nd Edition)
ISBN: 0137054890
EAN: 2147483647
Year: 2003
Pages: 150
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net