我正在努力建立一个"同意条款"复选框,如果选中,我希望用户被重定向到我的网站上的另一个页面但我只能得到它以确保检查checbox或按钮重定向但我似乎无法使它同时执行
我的HTML:
<form method="post">
<input type="checkbox" name="terms" id="checkbox" value="agree" required /><span style="color: #fff;">I agree to the </span><a href="tos.html" target="_blank">Terms of Services</a>
<br>
<div class="container">
<div class="flex-item">
<p align="right"><input type="submit" id="mBY" class="myButtonY" name="submit" value="Continue as a Modder"></p>
<script>
if (checkbox.Checked == true) {
RequestDispatcher dispatcher = request.getRequestDispatcher("");
dispatcher.forward(request, response);
}
</script>
</div>
<div class="flex-item">
<p align="left"><input type="submit" class="myButtonN" name="submit" value="Continue as a Non-Modder"></p>
</div>
</div>
</form>
我希望用户必须先检查复选框才能继续,然后点击按钮,然后根据他们点击的按钮,我希望将其重定向到我网站上的某个页面