hazzo
12-15-2007, 05:41 PM
Hi I'm using the script below for a menusystem which opens a new page in an iFrame. So far I'm only able to get it to work with 3 option values (a, b and c) and their corresponding varieties for box 2.
Is there anyone who can help me to get the script working for more values (d, e, f.......) and varieties that corresponds to them?
Many thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var varieties=[
["Kemikalietyp"],
["Kemi","Algicid","PHMB Desinfektion","Schock","0230"],
["Kemikalietyp","Sandfilter med bronsventil","Sandfilter med plastventil"],
];
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);
}
}
function loadPage(idx){
var bx2 = document.getElementsByName('box2')[0];
document.getElementById('disIframe').src = "kemi/"+ bx2.options[idx].text +".htm";
}
onload=function() {Box2(0);};
</script>
</head>
<body>
<p class="t01" style="FONT-SIZE: 12px">
<form name="myform" method="post" action="#">
<div>
<select name="box1" onchange="Box2(this.selectedIndex)">
<option value="a" selected>Kemikaliepaket</option>
<option value="b">Baquacil</option>
<option value="c">Saniklar</option>
</select>
<select name="box2" onchange="loadPage(this.selectedIndex)"></select>
</div>
</form>
<div id="ifram">
<iframe height="300" width="778" frameborder="0" scrolling="no" src="" id="disIframe"></iframe>
</div>
</body>
</html>
Is there anyone who can help me to get the script working for more values (d, e, f.......) and varieties that corresponds to them?
Many thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var varieties=[
["Kemikalietyp"],
["Kemi","Algicid","PHMB Desinfektion","Schock","0230"],
["Kemikalietyp","Sandfilter med bronsventil","Sandfilter med plastventil"],
];
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);
}
}
function loadPage(idx){
var bx2 = document.getElementsByName('box2')[0];
document.getElementById('disIframe').src = "kemi/"+ bx2.options[idx].text +".htm";
}
onload=function() {Box2(0);};
</script>
</head>
<body>
<p class="t01" style="FONT-SIZE: 12px">
<form name="myform" method="post" action="#">
<div>
<select name="box1" onchange="Box2(this.selectedIndex)">
<option value="a" selected>Kemikaliepaket</option>
<option value="b">Baquacil</option>
<option value="c">Saniklar</option>
</select>
<select name="box2" onchange="loadPage(this.selectedIndex)"></select>
</div>
</form>
<div id="ifram">
<iframe height="300" width="778" frameborder="0" scrolling="no" src="" id="disIframe"></iframe>
</div>
</body>
</html>