hazzo
09-24-2007, 04:10 AM
Hi, I'm using the script below and would like to be able to automatically load a page in an iframe (on the same page) when the last selection is made. For example Aircraft type "A340" would open a340.html in an ifram on the same page. Anyone has an idea on how to do it?
Is there also a way to have different amounts of subselections and redirect when the last possible selection is made? I.e. Airbus 340 would have two more selections type "-300" and "-600" and redirect when one of them is selected whereas A330 wouldn't have any more subselections and would redirect when selecting A330...
Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Aicraft selection</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
var varieties=[
["Aircraft type"],
["Aircraft type","A340","A330","A380"],
["Aircraft type","MD11","DC10","B747"],
["Aircraft type","J35","J37","J39"]
];
function Box2(idx) {
var f=document.myform;
f.box2.options.length=null;
for(i=0; i<varieties[idx].length; i++) {
f.box2.options[i]=new Option(varieties[idx][i], i);
}
}
onload=function() {Box2(0);};
</script>
</head>
<body>
<form name="myform" method="post" action="#">
<div>
<select name="box1" onchange="Box2(this.selectedIndex)">
<option value="a">Aircraft maker</option>
<option value="b">Airbus</option>
<option value="c">Boeing</option>
<option value="d">Saab</option>
</select>
<select name="box2"></select>
</div>
</form>
</body>
</html>
Is there also a way to have different amounts of subselections and redirect when the last possible selection is made? I.e. Airbus 340 would have two more selections type "-300" and "-600" and redirect when one of them is selected whereas A330 wouldn't have any more subselections and would redirect when selecting A330...
Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Aicraft selection</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
var varieties=[
["Aircraft type"],
["Aircraft type","A340","A330","A380"],
["Aircraft type","MD11","DC10","B747"],
["Aircraft type","J35","J37","J39"]
];
function Box2(idx) {
var f=document.myform;
f.box2.options.length=null;
for(i=0; i<varieties[idx].length; i++) {
f.box2.options[i]=new Option(varieties[idx][i], i);
}
}
onload=function() {Box2(0);};
</script>
</head>
<body>
<form name="myform" method="post" action="#">
<div>
<select name="box1" onchange="Box2(this.selectedIndex)">
<option value="a">Aircraft maker</option>
<option value="b">Airbus</option>
<option value="c">Boeing</option>
<option value="d">Saab</option>
</select>
<select name="box2"></select>
</div>
</form>
</body>
</html>