dacloo
09-14-2002, 05:56 PM
A selectbox does the following event:
<select name="mb_functie" id="mb_functie" onChange="redirect(document.properties.this.options.selectedIndex)">
and the actual code is:
<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[0][1]=new Option("wysiwyg_template_1 (Dit is de standaard pagina.)","1")
group[1][1]=new Option("wysiwyg_template_2 ()","1")
group[1][2]=new Option("news_template_1 (Een pagina voor functie 2)","2")
group[2][1]=new Option("news_template_2 (News template 2)","2")
group[2][2]=new Option("forum_template_1 ()","3")
group[3][1]=new Option("forum_template_2 ()","3")
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>
But javascript isn't giving me any errors, but doesnt do anything visually!
What's wrong? Thank you.
ps:
When changing selectbox to the following:
<select name="mb_functie" id="mb_functie" onChange="redirect(this.options.selectedIndex)">
I get: temp.options in null or not an object.
<select name="mb_functie" id="mb_functie" onChange="redirect(document.properties.this.options.selectedIndex)">
and the actual code is:
<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[0][1]=new Option("wysiwyg_template_1 (Dit is de standaard pagina.)","1")
group[1][1]=new Option("wysiwyg_template_2 ()","1")
group[1][2]=new Option("news_template_1 (Een pagina voor functie 2)","2")
group[2][1]=new Option("news_template_2 (News template 2)","2")
group[2][2]=new Option("forum_template_1 ()","3")
group[3][1]=new Option("forum_template_2 ()","3")
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>
But javascript isn't giving me any errors, but doesnt do anything visually!
What's wrong? Thank you.
ps:
When changing selectbox to the following:
<select name="mb_functie" id="mb_functie" onChange="redirect(this.options.selectedIndex)">
I get: temp.options in null or not an object.