我有两个单选按钮,当页面加载时,JavaScript禁用了该按钮。 RadioButton1
默认为选中状态。当我点击按钮做回发时,RadioButton1
不再被检查。禁用的单选按钮在回发后丢失值
任何人都知道为什么?
这是我的代码示例。后面的代码是空的。
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="group" Checked="true"/>
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="group" />
<asp:Button ID="Button1" runat="server" Text="Button"></asp:Button>
<script type="text/javascript">
window.onload = function() {
var RadioButton1 = document.getElementById('<%= RadioButton1.ClientID %>');
var RadioButton2 = document.getElementById('<%= RadioButton2.ClientID %>');
RadioButton1.disabled = true;
RadioButton2.disabled = true;
};
</script>
可能重复的[在JavaScript中禁用复选框,并将其识别为在服务器端检查](http://stackoverflow.com/questions/2462956/disable-a-checkbox-in-javascript-and-recognize-it在服务器端检查) – 2011-02-14 23:01:06