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

Exercises

If you want to explore the if statement and conditional expressions further, perform the following exercise:

  • You might have noticed that the example in Listing 7.5 is case sensitive. If you enter netscape, you won't be sent to the correct page. Modify the script to ignore case. (You can use the toLowerCase string method described in Hour 6, “Using Strings and Arrays,” and then compare the value with all-lowercase keywords.)

  • Modify the script in Listing 7.5 so that if the keyword does not match one of the defined ones, the text the user entered will be used as a URL and loaded into the browser.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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