简体   繁体   中英

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. If you can give me an example i would be grateful. PS sorry for my bad english:D here is a example

</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/nnEny/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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