通过同意条款和条件加载新页面提交按钮

Submit Button by Agreeing on Terms and Condition load new page

我正在阅读此处的其他几个提交按钮 post,但我需要帮助才能在接受 "terms and conditions"

后加载新页面
<script type="text/javascript">

  function checkForm(form)
  {
    if(!form.terms.checked) {
      alert("Please indicate that you accept the Terms and Conditions");
      form.terms.focus();
      return false;
    }
    return true;
  }

</script>

对于 HTML 我有

<form onsubmit="return checkForm(this);">
<p><input type="checkbox" name="terms"> I accept the <u>Terms and Conditions</u></p>
<p><input type="submit"></p>
</form>

现在,当 select 在选中一个框后提交时,我希望它能将他们引导到一个新页面(他们在被重定向到服务条款页面之前试图到达的那个页面)。

如果您想更改当前页面的url,可以使用以下代码:

document.location.href = "http://example.com";

但是,如果您想创建一个新页面,可以使用此代码:

var win = window.open('http://example.com', '_blank');
  win.focus();

这个例子使用了弹窗window,可以被浏览器屏蔽,所以我建议使用第一个例子。

根据 提供的建议,我采用了以下方法:

<form action="Games.html" method="POST" onsubmit="return checkCheckBox(this)">
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Agree & Continue">
<input type="button" value="Decline" onclick="document.location.href='index.html'";>
</form>