• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

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.)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint