• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 7. Testing and Comparing Values > Using Multiple Conditions with switch

Using Multiple Conditions with switch

Often, you'll use several if statements in a row to test for different conditions. Listing 7.3 shows one example of this technique.

Listing 7.3 Using Multiple if Statements

1: if (button=="next") window.location="next.html";
2: if (button=="previous") window.location="prev.html";
3: if (button=="home") window.location="home.html";
4: if (button=="back") window.location="menu.html";


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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