Javascript 如何在页面加载后禁用下拉列表框项目的选择?
根据dropdownlist box的第一个输入,第二个dropdownlist box应启用以供选择 已使用下面的javascript禁用项目选择Javascript 如何在页面加载后禁用下拉列表框项目的选择?,javascript,asp.net,drop-down-menu,Javascript,Asp.net,Drop Down Menu,根据dropdownlist box的第一个输入,第二个dropdownlist box应启用以供选择 已使用下面的javascript禁用项目选择 function close_other_box(box){ if(box.id="dropdown1" && box.selectedIndex<2){ document.getElementById('dropdown2').value="Select" document.getEl
function close_other_box(box){
if(box.id="dropdown1" && box.selectedIndex<2){
document.getElementById('dropdown2').value="Select"
document.getElementById('dropdown2').disabled=true
} else {
document.getElementById('dropdown2').disabled=false
}
}
函数关闭其他框(框){
如果(box.id=“dropdown1”和&box.selectedIndex使用window.onload
window.onload = function () {
document.getElementById('dropdown2').disabled=true;
}
下面是您可以在Body的Onload事件中调用Disable函数,如下所示
<script>
function disablesecondDropDown(){
document.getElementById('dropdown2').value="Select";
document.getElementById('dropdown2').disabled=true;
}
</script>
函数disablesecondDropDown(){
document.getElementById('dropdown2').value=“选择”;
document.getElementById('dropdown2')。disabled=true;
}
在Html中:-
<body onload="disablesecondDropDown()">
“如果”条件缺失“==”。