jeg vet ikke hva som er galt...men jeg får ikke scripet til å virke:
<script language="javascript" type="text/javascript">
var arr = [
["Valg 1",[
["2. valg 1 (1)",
["3. valg 1 (1-1)","3. valg 2 (1-1)","3. valg 3 (1-1)","3. valg 4 (1-1)"]],
["2. valg 2 (1)",
["3. valg 1 (1-2)","3. valg 2 (1-2)","3. valg 3 (1-2)"]],
["2. valg 3 (1)",
["3. valg 1 (1-3)","3. valg 2 (1-3)","3. valg 3 (1-3)","3. valg 4 (1-3)"]]]],
["Valg 2",[
["2. valg 1 (2)",
["3. valg 1 (2-1)","3. valg 2 (2-1)","3. valg 3 (2-1)","3. valg 4 (2-1)"]],
["2. valg 2 (2)",
["3. valg 1 (2-2)","3. valg 2 (2-2)"]],
["2. valg 3 (2)",
["3. valg 1 (2-3)","3. valg 2 (2-3)","3. valg 3 (2-3)","3. valg 4 (2-3)","3. valg 5 (2-3)","3. valg 6 (2-3)","3. valg 7 (2-3)","3. valg 8 (2-3)","3. valg 9 (2-3)","3. valg 10 (2-3)","3. valg 11 (2-3)","3. valg 12 (2-3)","3. valg 13 (2-3)","3. valg 14 (2-3)","3. valg 15 (2-3)","3. valg 16 (2-3)","3. valg 17 (2-3)","3. valg 18 (2-3)","3. valg 19 (2-3)","3. valg 20 (2-3)","3. valg 21 (2-3)"]],
["2. valg 4 (2)",
["3. valg 1 (2-4)","3. valg 2 (2-4)","3. valg 3 (2-4)","3. valg 4 (2-4)"]]]],
["Valg 3",[
["2. valg 1 (3)",
["3. valg 1 (3-1)","3. valg 2 (3-1)","3. valg 3 (3-1)"]],
["2. valg 2 (3)",
["3. valg 1 (3-2)","3. valg 2 (3-2)","3. valg 3 (3-2)"]],
["2. valg 3 (3)",
["3. valg 1 (3-3)","3. valg 2 (3-3)","3. valg 3 (3-3)"]],
["2. valg 4 (3)",
["3. valg 1 (3-4)","3. valg 2 (3-4)","3. valg 3 (3-4)"]],
["2. valg 5 (3)",
["3. valg 1 (3-5)","3. valg 2 (3-5)","3. valg 3 (3-5)"]]]]
];
//alert(arr1[1][1])
function initSels(){
createOpts(document.getElementById('sel1'));
createOpts(document.getElementById('sel3'));
}
function createOpts(sel){
var s = new Array();
var num = 0, txt = "arr";
var ar = opt = null;
var n = sel.selectedIndex;
var args = createOpts.arguments.length;
for(var i=1;args>i;i++){
s[i-1] = document.getElementById(createOpts.arguments[i]);
if(s[i-1]==sel)num=i;
}
if(args>1){
if(s[num])sel = s[num];
else return;
}
if(n==0&&args>1){
for(i=num;args>i+1;i++){
s[i].length = 0;
opt = document.createElement('OPTION');
s[i].appendChild(opt);
opt.value = "";
opt.text = "\74-- Vælg --";
}
return true
};
for(i=0;num>i;i++){
txt+="["+(s[i].selectedIndex-1)+"][1]";
}
ar = eval(txt);
sel.length = 0;
opt = document.createElement('OPTION');
sel.appendChild(opt);
opt.value = "";
opt.text = "-- Vælg --";
for(i=0;ar.length>i;i++){
opt = document.createElement('OPTION');
sel.appendChild(opt);
if(typeof ar[i] == 'object'){
opt.value = ar[i][0];
opt.text = ar[i][0];
}else{
opt.value = ar[i];
opt.text = ar[i];
}
}
if(args>num+2){
for(i=num+1;args-1>i;i++){
s[i].length = 0;
opt = document.createElement('OPTION');
s[i].appendChild(opt);
opt.value = "";
opt.text = "\74-- Vælg --";
}
}
}
</script>
</head>
<body onload="initSels()">
<form name="sels" action="
http://roenving.users.whitehat.dk" onsubmit="return false;">
<select name="sel3" id="sel3" onchange="createOpts(this,'sel3','sel4','sel5');">
<option value="" selected>Vis alle</option>
</select>
<select name="sel4" id="sel4" onchange="createOpts(this,'sel3','sel4','sel5');">
<option value="" selected><-- Vælg --</option>
</select>
<select name="sel5" id="sel5">
<option value="" selected
><-- Vælg --</option>
</select>
</form>
</body>
...
er det kanskje noe jeg har glemt?