Du får lige et ekstra eksempel for sjov:
(
http://www.eksperten.dk/spm/711841 )
... der er selvfølgelig også Roenving's
http://roenving.users.whitehat.dk/index.html?/WD4Selects-beta.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title>
<script type="text/javascript">
var optinpm=['Vælg','Sko','Bil','Slik'];
var optinp=[['Vælg type'],['Adidas','Fila','Levis','Nike','Wrangler'],['Audi','Ford','Mazda','Opel','Pontiac'],['Heksehyl','Skolekridt','Skumbananer']];
function domopt(tmpnr,tmpval){
sel=document.getElementsByName(tmpnr)[0];
while(sel.childNodes.length>0)sel.removeChild(sel.childNodes[0]);
if(tmpnr=='drop1')tmparr=optinpm;
else tmparr=optinp[tmpval];
for(i=0;i<tmparr.length;i++){
tmpnode=document.createElement("option");
tmptxt=document.createTextNode(tmparr[i]);
tmpnode.appendChild(tmptxt);
sel.appendChild(tmpnode);
}
if((tmpnr=='drop1')||(tmpnr=='drop2')&&(tmpval==0)){
document.getElementsByName('drop2')[0].setAttribute("disabled","disabled");
if(tmpnr=='drop1')sel.onchange=function(){domopt('drop2',this.selectedIndex);}
}else document.getElementsByName('drop2')[0].removeAttribute("disabled");
}
window.onload=function(){domopt('drop2',0);domopt('drop1',-1);}
</script>
<style type="text/css">
html,body{padding:0px;margin:0px;}
body{margin:10px;}
div.leftit{float:left;width:100px;}
select{width:200px;}
</style></head>
<body>
<div class="leftit">Vælg type:</div>
<select size="1" name="drop1">
<option>Javascript kræves</option>
</select>
<br>
<div class="leftit">Vælg mærke:</div>
<select size="1" name="drop2">
<option>Javascript kræves</option>
</select>
</body></html>