JS 表单submit() 提交无效的问题
发布日期:2021-09-30 11:34:35 浏览次数:7 分类:技术文章

本文共 632 字,大约阅读时间需要 2 分钟。

<script>

 window.onload = login;
 function login(){
  document.getElementById("username").value = '<?php  echo $_COOKIE["username"]; ?>';
  document.getElementById("password").value = '<?php  echo $_COOKIE["password"]; ?>';
  document.getElementById("loginForm").submit();
 }
</script>

 <form id="loginForm"  action="index.php?user-login" method="post" >

  <input  id="username"    type="text" />
  <input  id="password"    type="password" />
  <input name="submit" type="submit" value="登录"/>
</form>

 

 

=======================================

 

 

JS 方法中的 submit() 不执行  页面没有跳转。

 

 

在群里 网友 帮我解答了。  很感谢。

 

 

<input name="submit" ,按钮的名字不要取成关键字

你调用submit()的时候,JS不会执行,因为有的名字叫submit

 

 

转载地址:https://blog.csdn.net/id19870510/article/details/5299137 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:自定义view 读取 属性No resource identifier found for attribute
下一篇:读取layout属性-AttributeSet TypedArray

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月18日 22时10分43秒