Another example is the options button. You can select certain item then click OK, it will bring you to the selected page.The codes are shown below:
| Search for your books by selecting a category, then click OK . |
<SCRIPT
LANGUAGE="JavaScript">
//created by Liew Voon Kiong April 24 1998 All Rights Reserved.
function loadHtml(form){
if (form.list.selectedIndex==0) location="art.html"
if (form.list.selectedIndex==1) location="astro.html"
if (form.list.selectedIndex==2) location="bestsell.html"
if (form.list.selectedIndex==3) location="business.html"
if (form.list.selectedIndex==4) location="children.html"
if (form.list.selectedIndex==5) location="computer.html"
if (form.list.selectedIndex==6) location="health.html"
if (form.list.selectedIndex==7) location="mystery.html"
if (form.list.selectedIndex==8) location="horror.html"
if (form.list.selectedIndex==9) location="nonfic.html"
if (form.list.selectedIndex==10) location="romance.html"
if (form.list.selectedIndex==11) location="science.html"
if (form.list.selectedIndex==12) location="scific.html"
if (form.list.selectedIndex==13) location="self.html"
if (form.list.selectedIndex==14) location="sports.html"
if (form.list.selectedIndex==15) location="travel.html"
if (form.list.selectedIndex==16) location="young.html"
if (form.list.selectedIndex==17) location="music.html"
}
</Script>
Let these two examples be the introduction to a series of articles on JavaScript, come back regularly for the updates. By the way, feel free to use my examples, but please address the programmer.
[Back
to HTMLTutorial][Back to Vbtutor]<Chapter 2>