- Detecting Browser Plug-ins
- Around and Around with Loops
- Writing with Loops
- Using For/In Loops
- Using Do/While Loops
- Checking if Java Is Enabled
- Functions
- Using Multi-level Conditionals
- Working with Functions That Return Values
- Handling Errors
- Putting More than One Script on a Page
- Scrolling Status Bars
- Status Bar Messages
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.

Figure 3.18 Both the plug-in check and the function passing examples are shown in the resulting page.