同意条款和条件的 HTML 复选框和提交按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21523730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:48:09  来源:igfitidea点击:

HTML checkbox & Submit Button by Agreeing on Terms and Condition

htmlauthenticationcheckboxsubmitwireless

提问by user3239387

I'm designing an html page for WiFi authentication and I would like to introduce in this page a Checkbox and Submit button, upon reading the Terms and Condition and Checking the CheckBox, the Submit button will be active.

我正在设计一个用于 WiFi 身份验证的 html 页面,我想在此页面中引入一个复选框和提交按钮,在阅读条款和条件并选中复选框后,提交按钮将处于活动状态。

Is this doable?

这是可行的吗?

thanks,

谢谢,

回答by Butchi Reddy Velagala

<html>
<head>
<script>
 function disableSubmit() {
  document.getElementById("submit").disabled = true;
 }

  function activateButton(element) {

      if(element.checked) {
        document.getElementById("submit").disabled = false;
       }
       else  {
        document.getElementById("submit").disabled = true;
      }

  }
</script>
</head>

<body onload="disableSubmit()">
 <input type="checkbox" name="terms" id="terms" onchange="activateButton(this)">  I Agree Terms & Coditions
<br><br>
  <input type="submit" name="submit" id="submit">
</body>
</html>