日期:2014-05-17 浏览次数:20396 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ULTest.aspx.cs" Inherits="ULTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
//方法1: jquery
function test_jQuery(obj){
$("#div1 :checkbox").prop("disabled",obj.value==="3");
}
//方法2: 纯js
function test(obj){
var chks = document.getElementById("div1").getElementsByTagName("input");
for(var i=0;i<chks.length;i++){
if(obj.value==="3"){
chks[i].setAttribute('disabled','disabled');
}else{
chks[i].removeAttribute('disabled');
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="请选择" Value=""></asp:ListItem>
<asp:ListItem Text="录入员" Value="1"></asp:ListItem>
<asp:ListItem Text="管理员" Value="2"></asp:ListItem>
<asp:ListItem Text="查询员" Value="3"></asp:ListItem>
</asp:DropDownList>
<div id="div1" >
<input type="checkbox" />财务部<br />
<input type="checkbox" />审计部<br />
<input type="checkbox" />纪委<br />
</div>
</form>
</body>
</html>
using System;
using&