110,915
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript" type="text/javascript">
function getRadioValue()
{
var inputs = document.getElementById('<%= RadioButtonList1.ClientID %>').getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++)
{
if(inputs[i].type == "radio")
{
var radio = inputs[i];
if(radio.checked)
alert(radio.value);
}
}
}
</script>
<script language="javascript" type="text/javascript">
function getRadioValue()
{
var inputs = document.getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++)
{
if(inputs[i].type == "radio")
{
var radio = inputs[i];
if(radio.checked)
alert(radio.value);
}
}
}
</script>
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="CategoryName"
DataValueField="CategoryID" />
<input id="Button1" type="button" value="button" onclick="return getRadioValue()" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">
</asp:SqlDataSource>