为了账号安全,请及时绑定邮箱和手机立即绑定

表单容器输入值问题

表单容器输入值问题

蝴蝶不菲 2022-06-16 14:58:07
单选按钮提供访问和撤销访问在 HTML 页面中。单击提供访问权限时,它将显示一些从用户那里获取值的选项,这在没有蚂蚁问题的情况下工作,与单击撤销访问按钮相同,它将显示一些从用户那里获取值的选项。但是这里的问题是撤消访问权限也从提供访问单选按钮中获取值。知道下面的代码有什么问题<html><head>  <script type="text/javascript">    function empty() {      var x;      x = document.getElementById("qx").value;      y = document.getElementById("pwd").value;      if (x == "") {        alert("QX number should not be null");        return false;      };      if (y == "") {        alert("Password should not be null");        return false;      };    }  </script>  <style>    .top {      position: relative;      background-color: #ffffff;      height: 68px;    }        .top1 {      top: 110px;      left: 476px;      position: fixed;      background-color: #ffffff;      height: 70px;    }  </style></head><body>  <script type="text/javascript">    function displayForm(c) {      if (c.value == "1") {        document.getElementById("provideContainer").style.visibility = 'visible';        document.getElementById("revokeContainer").style.visibility = 'hidden';      } else if (c.value == "2") {        document.getElementById("provideContainer").style.visibility = 'hidden';        document.getElementById("revokeContainer").style.visibility = 'visible';      } else {}    }  </script>  <center>    <font color="green">      <h2>Please Select the below option</h2>    </font><br>    <form>      <input value="1" type="radio" name="formselector" onClick="displayForm(this)"></input>      <font size="3" color="orange">Provide Access</font>      <input value="2" type="radio" name="formselector" onClick="displayForm(this)"></input>      <font size="3" color="orange">Revoke Access</font>      </form>    </div></body></html>
查看完整描述

1 回答

?
翻翻过去那场雪

TA贡献2065条经验 获得超14个赞

如果您的意思是如果 qx 号码和密码不为空,则使用 Javascript 进行检查,这是因为您在 revoke 中分配输入并提供访问相同的 id 以进行检查。

(id="qx" 和 id="pwd")

这就是 id 的作用。它应该仅在此站点上存在一次。


查看完整回答
反对 回复 2022-06-16
  • 1 回答
  • 0 关注
  • 138 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号