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

Chapter 3. Language Essentials > Putting More than One Script on a Page

Putting More than One Script on a Page

Up to this point in the book, you've seen scripts that do one thing at a time. But in the real world, you're more likely to want to perform a variety of things using a script, or even have multiple scripts on one page. You might want to have a script that redirects the JavaScript-less user to an alternate page, check for a plug-in, and discover what browser the user has, all in one script. A good way to do multiple things on a page is to group the things that are appropriate to header scripts together, and group body script actions together as well. Script 3.11 shows you how to put the Script 3.2 and 3.7 examples together into one page. Figure 3.18 shows the result of the combined scripts.

Script 3.11. This script combines the features of Scripts 3.2 and 3.7 into one page.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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