Hi Clement,
<html>
<head>
<title></title>
<script type="text/javascript"> // javascript code starts here
page = document.frmOne.cmbAge.value // u are getting some form value, formname = frmone, fieldname or HTML form element name=cmbAge and you are assigning that to page variable. According to your case, page value will be in range 1-4, or it ll go to default case, where u alert error message.
switch (page) {
case "1":
document.URL = "page1.html" // if page is '1', document.URL ll be "page1.html"
break
case "2":
document.URL = "page2.html" // if page is '2', document.URL ll be "page2.html"
break
case "3":
document.URL = "page3.html" // if page is '3', document.URL ll be "page3.html"
break
case "4":
document.URL = "page4.html" // if page is '4', document.URL ll be "page4.html"
break
default:
alert("An error occurred, so we are staying here")
}
</script></head><body>
</html>
Dec 26, 2010