jQuery
$(document).ready(function () {
$('#ButtonRadioValue').click(function () {
var selValue = $('input[name=radio]:checked').val();
});
});
收音机
<div id="radio" align="center">
<input type="radio" id="radio1" value="BtnNextCaseClick" name="radio" checked="checked"/><label for="radio1" style="width: 109px; margin-right:-.9em">Next</label>
<input type="radio" id="radio2" value="CloseCase" name="radio" /><label for="radio2" style="margin-right:-.9em">Close Case</label>
<input type="radio" id="radio3" value="CloseWeb" name="radio" /><label for="radio3" style="width: 109px">Close Web</label>
</div>
所以,在那个收音机下面我有一个按钮,我希望它根据收音机选择执行不同的代码。该值存储在selValue
. 那么我怎样才能告诉onclick
事件运行里面的内容selValue
按钮
<asp:Button ID="ButtonRadioValue" CssClass="customButton" runat="server" onclick=" js variable here" Text="Aceptar" style="width: 111px; height: 30px"/>
谢谢。
编辑
因为没有真正需要客户端程序。我是从服务器端做的this.radio1.Checked == true