这是未完成的脚本:
<script type="text/javascript">
$(document).ready(function(){
$('#box1').hide();
$('#box2').hide();
$('#box3').hide();
$("#thechoices").change(function(){
if(this.value == 'all'){
$("#boxes").children().show();
}else{
$("#" + this.value).show().siblings().hide();
}
});
$("#thechoices").change();
});
</script>
HTML是:
<div id="SelectedBoxContainer">
<!--Selected DivByID goes here-->
</div>
<!--Selected one of these Divs-->
<div id="boxes">
<div id="box1"><p>Box 1 stuff…</p></div>
<div id="box2"><p>Box 2 stuff…</p></div>
<div id="box3"><p>Box 3 stuff…</p></div>
<div id="box4"><p>Box 1 stuff…</p></div>
<div id="box5"><p>Box 2 stuff…</p></div>
<div id="box6"><p>Box 3 stuff…</p></div>
</div>
我需要的是使用 Dropdownlist 从div id="boxes"中选择一个 div并将其绘制在div id="SelectedBoxContainer"内,
如何做到这一点?提前致谢!