Previous Example-|-Next Example-|-Return to Chapter Listing

Example 14.17:
Picking Your Destination

You can use the following selection box to pick which window you want to see, from ten options. When you click on the item, that window automatically opens (of course you could have a button that checks what you've selected and then opens the window, if you wish).

Note that this script uses the focus() method to bring the secondary window back again. If you don't have the Atlas Preview Release 2 (Navigator 3.0 beta 3) or later this feature won't work. If you didn't close the secondary window before clicking on another entry in the list box, you'll have to switch to the window manually if you didn't close it .
This is the script we used: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- function Dest(form) { var sGo if (form.select1.selectedIndex == 0) sGo = "14-17a.htm"; if (form.select1.selectedIndex == 1) sGo = "14-17b.htm"; if (form.select1.selectedIndex == 2) sGo = "14-17c.htm"; if (form.select1.selectedIndex == 3) sGo = "14-17d.htm"; if (form.select1.selectedIndex == 4) sGo = "14-17e.htm"; if (form.select1.selectedIndex == 5) sGo = "14-17f.htm"; if (form.select1.selectedIndex == 6) sGo = "14-17g.htm"; if (form.select1.selectedIndex == 7) sGo = "14-17h.htm"; if (form.select1.selectedIndex == 8) sGo = "14-17i.htm"; if (form.select1.selectedIndex == 9) sGo = "14-17j.htm"; form.select1.blur() ; Win1=open(sGo,"Window1","width=400,height=200"); Win1.focus() } //--> </SCRIPT> Here are the buttons: <form> <select name="select1" size=4 onchange="Dest(this.form)"> <option>The White Room <option>The Red Room <option>The Green Room <option>The Purple Room <option>The Gray Room <option>The Brown Room <option>The Yellow Room <option>The Blue Room <option>The Crimson Room <option>The Olive Room </select> </form>
Previous Example-|-Next Example-|-Return to Chapter Listing