Tach, hier nochmal genauer:
[link]http://www.atgconsulting.com/oodynlistbox.asp[/link]
Ich habs so gelöst:
Skript am im Head der Page:
<script type="text/javascript">
<!--
//declare your arrays...
var abbrev = new Array();
var group_id = new Array();
var title = new Array();
var rel_to = new Array();
//fill your arrays...
<%
Dim intCount
intCount=0
while not rs.eof
response.write "abbrev["&intCount&"]='"&rs(0)&"';"&vbcrlf
response.write "group_id["&intCount&"]="&rs(1)&";"&vbcrlf
response.write "title["&intCount&"]='"&rs(2)&"';"&vbcrlf
response.write "rel_to["&intCount&"]='"&rs(3)&"';"&vbcrlf
intCount=intCount+1
rs.Movenext
wend
%>
function selectall(oList)
{
for (var i = 0; i < rel_to.length; i++){
oList.options[oList.options.length] = new Option(abbrev[i]+" - "+title[i], group_id[i]);
}
//always select ALL in responsible group
document.forms[0].responsible_group.selectedIndex = 0;
}
function set_groupbox(oList)
{
var curform = oList.form;
clearCombo(curform.group);
var newvalue = oList[oList.selectedIndex].value;
//fillCombo(curform.group, newvalue);
fillbox(curform.group, newvalue);
}
function fillbox(oList, vValue){
if (vValue != ""){
for (var i = 0; i < rel_to.length; i++){
if (rel_to[i]==vValue) {
oList.options[oList.options.length] = new Option(abbrev[i]+" - "+title[i], group_id[i]);
} else ;
}
} else List.options[0] = new Option("Select Responsible Group", "");
}
function clearCombo(oList){
for (var i = oList.options.length - 1; i >= 0; i--){
oList.options[i] = null;
}
oList.options[0] = new Option("ALL", "")
oList.selectedIndex = -1;
}
-->
</script>
Dann im Body:
<body onload="javascript:selectall(document.forms[0].group)">
Die erste Selectbox hat onChange="set_groupbox(this);",
die zweite nur
<select id="group" name="group" size="1" style="width:335px">
<option value="" selected>ALL</option>
</select>