js调用RadioButton1

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function ischeck() {
var txt1=document.getElementById("TextBox1");
var txt2=document.getElementById("TextBox2");
var rdb1=document.getElementById("RadioButton1");
var rdb2=document.getElementById("RadioButton2");
if (rdb1.checked) {
alert("RadioButton1");
txt1.value = "";
txt2.value = "";
}
if (rdb2.checked) {
alert("RadioButton2");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="RadioButton1" runat="server" onclick="ischeck()" GroupName="aa"/>
<asp:RadioButton ID="RadioButton2" runat="server" onclick="ischeck()" GroupName="aa"/>
<asp:TextBox ID="TextBox1" runat="server" Text="aa" ></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Text="bb"></asp:TextBox>
</div>
</form>
</body>
</html>

原文地址:https://www.cnblogs.com/kaiwanlin/p/5289856.html