简体   繁体   English

Javascript onclick或jquery触发器

[英]Javascript onclick or jquery trigger

I want a javascript or jquery i am not sure which one that when i press the fift radio buton and then click next to send me to another html page. 我想要一个JavaScript或jquery,但我不确定当我按下快速收音机按钮,然后单击“下一步”将我发送到另一个html页面时,哪一个。 If you can give me an example i would be grateful. 如果您能给我一个例子,我将不胜感激。 PS sorry for my bad english:D here is a example PS对不起,我的英语不好:D这是一个例子

</head>

<body>

<p>please select a year</p>
<form action="picture2.html">
<input type="radio" name="answer" value="2years">0-2 years<br>
<input type="radio" name="answer" value="2years">3-5 years<br>
<input type="radio" name="answer" value="2years">6-10 years<br>
<input type="radio" name="answer" value="2years">More than 10 years<br>
<input type="radio" id="demo" name="answer" value="terminate">i have 20 years (if this is selected go to another html page)<br>
<input type="button" id="button" onclick="myFunction" value="Next">
</form>


<script>
$(function(){
  $("input:radio:fifth").click(myFunction();
});

function myFunction()
{
document.getElementById("button").onclick="window.location.href='picture2.html'";
}
</script>

</body>
</html>

Please follow the link given below: 请点击以下链接:

http://jsfiddle.net/u8jD9/ http://jsfiddle.net/u8jD9/

http://jsfiddle.net/nnEny/ http://jsfiddle.net/nnEny/

 if ($('#rdo1').is(':checked')) {
                    window.location.replace("http://www.stackoverflow.com");
                }
                else if ($('#rdo2').is(':checked')) {
                    window.location.replace("http://www.exchange.com");
                }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM