日期:2014-05-16 浏览次数:20374 次
<form id="f1">
<select id="s1" name="s1" >
<option value="" >请选择</option>
<option value="1" >1</option>
<option value="2">2</option>
</select>
<select id="s2" name="s2" disabled >
<option value="" >请选择</option>
<option value="a" >a</option>
<option value="b">b</option>
</select>
<select id="s3" name="s3" disabled >
<option value="" >请选择</option>
<option value="abc" >abc</option>
<option value="efg">efg</option>
</select>
</form>
<script>
document.write( new Date().getTime() )
function g(id){ return document.getElementById(id) }
g('s1').onchange=function(){
g('s2').disabled=!this.value;
}
g('s2').onchange=function(){
g('s3').disabled=!this.value;
}
g('s3').onchange=function(){
window.name=[g('s1').value,g('s2').value,this.value];
this.form.submit();
}
window.onload=function(){
var vs=this.name.split(',')
for(var i=0;i<vs.length;i++){
g('s'+(i+1)).value=vs[i];
if(i!=2) g('s'+(i+1)).onchange()
}
}
</script>