PDA

View Full Version : Double combo box question


dacloo
09-13-2002, 12:23 PM
<html>
<head>
<title>hoi></title>
</head>
<body>

<form name="properties" method="post">

<select name="mb_functie" id="mb_functie" onChange="redirect(this.options.selectedIndex)">
<option value="1">WYSIWYG editor voor het visueel opmaken van pagina's</option>
<option value="2">News function</option>
<option value="3">Forum function</option>
</select>

<br>
<select name="mb_sjabloon" id="mb_sjabloon">
<option value="1" selected>Dit is de standaard pagina. (wysiwyg_template_1)</option>
<option value="2" selected> (wysiwyg_template_2)</option>
</select>

<br>
<input type="submit" name="Submit" value="add page">

<script language=javascript">
<!--
var groups=document.properties.mb_functie.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[1][0]=new Option("wysiwyg_template_1 (Dit is de standaard pagina.)","1")
group[1][1]=new Option("wysiwyg_template_2 ()","2")
group[2][0]=new Option("news_template_1 (Een pagina voor functie 2)","3")
group[2][1]=new Option("news_template_2 (News template 2)","4")
group[3][0]=new Option("forum_template_1 ()","5")
group[3][1]=new Option("forum_template_2 ()","6")

var temp=document.properties.mb_sjabloon

function redirect(x) {
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
//-->
</script>

</form>
</body>
</html>


The above script is my implementation of the "double combo box" script on this site. It's an excellent written script, but I seem to get the "object expected" error when choosing another value in the first combo box. My guess is there is something wrong at the OnChange line, but I cannot find out what is wrong.

Can someone help me out? Thank you.

dacloo
09-14-2002, 12:37 AM
:confused: