[英]Disable input type radio button click from cs page and send alert to user using js?
i have a radio button which is disable for managers but enable for otherrs it need to handle from cs page radio button onclick .the code to disable radio from aspx is 我有一个单选按钮,它对经理禁用,但对其他人启用,它需要从cs页面单选按钮onclick处理。禁用aspx单选的代码是
<INPUT type="radio" name="myButton" value="theValue"
onclick="this.checked=false;
alert('Sorry, this option is not for manager!')">
how to do it in cs page i am doing 我正在做的CS页面中如何做
rbtnOpen.Attributes.Add("OnClick", "this.checked=false; alert('Sorry, this option is not available!')");
its working fine and also showing the alert but when but page is refreshing . 它的工作正常,并显示警报,但何时页面刷新。 let say i have 3 stat A,B,C.... for an iten B is selected radio for manager if he clicks A or C is should prompt the alert after closing the alert it should again show B ..in my case its prompting the alert but all the radio button become uncheck
假设我有3个状态A,B,C ....如果一个经理B被选择为经理,如果他单击A或C,则在关闭警报后应该提示警报,它应该再次显示B。提示警报,但所有单选按钮都取消选中
Try this 尝试这个
<!DOCTYPE html>
<html>
<head>
<script>
function check()
{
alert('Sorry, this option is not available!');
document.getElementById("b").checked=true;
}
</script>
</head>
<body>
A<input type="radio" name="gender" id="a" value="a" onclick="check()"/>
B<input type="radio" name="gender" id="b" value="b" />
C<input type="radio" name="gender" id="c" value="c" onclick="check()"/>
</body>
</html>
Why don't you completely disable the control for managers, instead of displaying it as a clickable input? 为什么不完全禁用管理器控件,而不是将其显示为可点击的输入? That way you'd make it even more clear that managers cannot use that option.
这样一来,您将更加清楚经理无法使用该选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.