以下图片是一个详细说明风险警告的弹出窗口,然后要求用户选择两个单选按钮中的一个。当“我同意”(提交)按钮被单击时,它应根据选择的单选按钮重定向到不同的页面。提交按钮有一个jquery类。有人帮我用jquery代码检查选择了哪个单选按钮并重定向到不同的页面?
IMG http://i43.tinypic.com/2aeuqtf.png
html在下面,
<div id="mask">
</div>
<!-- create white empty box -->
<div id="boxes" class="bodytext">
<!-- things that go in the box -->
<div id="dialog" class="window">
<strong>Disclaimer and Risk Warnings</strong>
<br />
<br />
<div class="bodytext" style="overflow: auto; height: 160px; width: 500px; border: activeborder 1px solid;">
</div>
<br/>
<strong> Please select the user type that applies to you</strong>
<br/>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem>Private Clients</asp:ListItem>
<asp:ListItem>Professional Intermediaries</asp:ListItem>
</asp:RadioButtonList>
<p>
<input id="AcceptButton" type="button" value="I Agree" class="close" style="margin-left: 215px" />
</p>
</div>
</div>
jquery类位于
之下 $('.window .close').click(function (e) {
$.cookie("CamSession1", "CAM");
if ($('#Private Clients').is(':checked')) {
window.location.replace("http://stackoverflow.com");
}
else if ($('#Professional Intermediaries').is(':checked')) {
window.location.replace("http://exchange.com");
}
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
答案 0 :(得分:2)
试试这个
HTML
<div id="mask">
</div>
<!-- create white empty box -->
<div id="boxes" class="bodytext">
<!-- things that go in the box -->
<div id="dialog" class="window">
<strong>Disclaimer and Risk Warnings</strong>
<br />
<br />
<div class="bodytext" style="overflow: auto; height: 160px; width: 500px; border: activeborder 1px solid;">
</div>
<br/>
<strong> Please select the user type that applies to you</strong>
<br/>
<input type="radio" name="rdotnc" id="rdo1" />Private Clients
<input type="radio" name="rdotnc" id="rdo2"/>Professional Intermediaries
</asp:RadioButtonList>
<p>
<input id="AcceptButton" type="button" value="I Agree" class="close" style="margin-left: 215px" />
</p>
</div>
</div>
的Javascript
$('.window .close').click(function (e) {
//$.cookie("CamSession1", "CAM");
if ($('#rdo1').is(':checked')) {
window.location.replace("http://www.stackoverflow.com");
}
else if ($('#rdo2').is(':checked')) {
window.location.replace("http://www.exchange.com");
}
$('#mask').hide();
$('.window').hide();
});
检查小提琴here