62,046
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButton ID="RadioButton1" GroupName="x" runat="server" />
<asp:RadioButton ID="RadioButton2" GroupName="x" runat="server" Checked="true" />
<div id="blockUI" style="background-color: #FFF; width: 100%; height: 60px; position: absolute;
left: 0px; top: 0px; z-index: 50000; -moz-opacity: 0; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'; filter: alpha(opacity=0);"
onclick="return false" onmousedown="return false" onmousemove="return false" onmouseup="return false"
ondblclick="return false">
</div>
</form>
</body>
</html>
<asp:RadioButton ID="rbtn_1" runat="server" Text="boy" GroupName="sex" Checked="true" />
<asp:RadioButton ID="rbtn_2" runat="server" Text="girl" GroupName="sex" />
RadioButton1.Attributes.Add("onclick", "return false");
.因为管理员不能单击girl按钮,但是如果他单击girl按钮的话,girl按钮不会被选中,同时boy按钮也失去了被选中的状态。此时应该用js代码重新将boy按钮设置为选中状态<asp:RadioButton ID="rbtn_1" runat="server" Text="boy" GroupName="sex" Checked="true" />
<asp:RadioButton ID="rbtn_2" runat="server" Text="girl" GroupName="sex" />
RadioButton1.Attributes.Add("onclick", "return false");
.因为管理员不能单击girl按钮,但是如果他单击girl按钮的话,girl按钮不会被选中,同时boy按钮也失去了被选中的状态。此时应该用js代码重新将boy按钮设置为选中状态<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
RadioButton1.Attributes.Add("onclick", "this.checked=!this.checked");
RadioButton2.Attributes.Add("onclick", "this.checked=!this.checked");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButton ID="RadioButton1" GroupName="x" runat="server" />
<asp:RadioButton ID="RadioButton2" GroupName="x" runat="server" />
</form>
</body>
</html>
RadioButton1.Attributes.Add("onclick", "return false");
if(user==“管理员")
{
CheckBox1.Attributes("onclick", "return false");
}