javascript - Submit Button by Agreeing on Terms and Condition load new page -
i reading on few other submit button post on here need assistance getting 1 load new page upon accepting "terms , conditions"
<script type="text/javascript"> function checkform(form) { if(!form.terms.checked) { alert("please indicate accept terms , conditions"); form.terms.focus(); return false; } return true; } </script>
for html have
<form onsubmit="return checkform(this);"> <p><input type="checkbox" name="terms"> accept <u>terms , conditions</u></p> <p><input type="submit"></p> </form>
now when select submit after checking box want direct them new page(the 1 trying before being redirected terms of service page).
if change url of current page, can use following code:
document.location.href = "http://example.com";
however, if create new page, can use code:
var win = window.open('http://example.com', '_blank'); win.focus();
this example uses pop-up window, can blocked browser, suggest using first example.
wiki
Comments
Post a Comment