javascript - how to open a new window for a specified java code -
this question has answer here:
i have code below on page. works. can not find out how make open in new window. window.open doesn't work on it. needed.
<form method="post"> <input type="radio" name="button" value="index1.html" checked>this button goes index1.html (default)<br> <input type="radio" name="button" value="index2.html">this button goes index2.html<br> <input type="radio" name="button" value="index3.html">this button goes index3.html<br> <input type="submit" value="continue"> <script> $(function(){ $("form").submit(function(e) { e.preventdefault(); window.location = $(this).find('input[type="radio"]:checked').val(); }); }); </script> </form>
here update should work using window.open:
<form method="post"> <input type="radio" name="button" value="http://www.google.com" checked>this button goes index1.html (default) <br> <input type="radio" name="button" value="http://www.yahoo.com">this button goes index2.html <br> <input type="radio" name="button" value="http://www.stackoverflow.com">this button goes index3.html <br> <input type="submit" value="continue"> </form> <script> $(function () { $("form").submit(function (e) { e.preventdefault(); var url = $(this).find('input[type="radio"]:checked').val(); window.open(url); }); }); </script>
Comments
Post a Comment