日期:2014-05-16  浏览次数:20302 次

javascript求助
根据从下拉列表框里所选择的选项会动态生成一组复选框,要求当勾选复框任一的时候下拉列表框就变为不可选,取消时其可变可选,请问这能实现吗?求高手帮忙

------解决方案--------------------
<script language= "javascript ">
function chgCB(strTmp)
{
document.getElementById( "chgDiv ").innerHTML = " <input type= 'checkbox ' name= 'checkbox ' value= 'checkbox ' onclick= 'chgST(this); '/> " + strTmp;
}

function chgST(obj)
{
if(obj.checked == true)
{
document.getElementById( "select ").disabled = true;
}
else
document.getElementById( "select ").disabled = false;
}
</script>
<div>
<select name= "select " id= "select " onchange= "chgCB(document.getElementById( 'select ').value); ">
<option value= "111 "> 111 </option>
<option value= "222 "> 222 </option>
<option value= "333 "> 333 </option>
</select>
</div>
<div id= "chgDiv ">

</div>