重複の可能性:
JavaScript で RadioButtonList の SelectedValue を特定するにはどうすればよいですか?
javascriptでasp.net radiobuttonlistから選択したラジオボタンを取得したいです。テキストボックスの onchange イベントで、以下のコードを書きました。
<asp:RadioButtonList CssClass="radioWithProperWrap"
ID="RadioButtonList1" runat="server" CellPadding="0"
CellSpacing="0" RepeatColumns="2" RepeatDirection="Horizontal"
>
<asp:ListItem Value="1" Selected="True">Aylık Ödeyeceğim Taksite Göre</asp:ListItem>
<asp:ListItem Value="2">Toplam Alacağım Krediye Göre</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TempTxtBox" runat="server" onchange="myFun()" ></asp:TextBox>
そしてJavaScript;
<script language="javascript" type="text/javascript">
function myFun() {
var deger = document.getElementById('<%=TempTxtBox.ClientID%>').value;
var vade = document.getElementById('<%=MaturitytxtBox.ClientID%>').value;
var radioButtons = document.getElementsByName('<%=RadioButtonList1.ClientID%>');
var radio = radioButtons.item(0).checked;
alert(radio);
}
</script>
それは機能していません..誰でも助けることができますか?