1 <script type="text/javascript" language="javascript"> 2 function CheckDropDownList() { 3 var dropDownList = document.getElementById("<%=DropDownListID.ClientID %>"); //获取DropDownList控件 4 var dropDownListValue = dropDownList.options[dropDownList.selectedIndex].value; //获取选择项的值 5 //注:DropDownListID是DropDownList控件的ID。 6 7 //JS验证是否有非0值: 8 if (dropDownListValue == 0) { 9 alert("请选择……."); 10 dropDownList.focus(); 11 return false; 12 } 13 else { 14 return true; 15 } 16 } 17 </script>
function enble() { var ddl = document.getElementById("<%=ddl_YesNo_State.ClientID %>"); var txt = document.getElementById("<%=btn_SaveALL.ClientID %>"); var ddlValue = ddl.options[ddl.selectedIndex].value; if (ddlValue.toString() == "已发放") { txt.disabled = true; } else { txt.disabled = false; } }