<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登入界面</title>
<style>
.mydiv{
margin-top: 250px;
width: 500px;
left: 600px;
height: auto;
position: absolute;
}
</style>
<script>
function myclick(){
var name=document.getElementById("name").value;
var password=document.getElementById("password").value;
var patternid=/([a-zA-X0-9]){5,10}/
var patternpassword=/([[a-zA-X0-9]){5,10}/
if(name==""|| password==""){
alert("账号或密码不能为空");
}
else{
if(patternid.test(name)){
if(patternpassword.test(password)){
documnent.getElementById("form").submit() /*如果账号密码都符合要求再提交*/
return true;
}else{
alert("密码格式不正确,请输入5-10个数字或字母")
}
}
else{
alert("账号格式不正确,请输入5-10个数字或字母")
}
}
}
</script>
</head>
<body background="shangu.png" style=" background-repeat:no-repeat ;background-size:100% 100%;
background-attachment: fixed;">
<form action="user.html" method="POST" id="form" onsubmit="return myclick()">
<div class="mydiv">
<div class="login">
<div class="log-con">
<p><input type="text" id="name" style="width:250px; height:30px;" placeholder="请输入账号"></p>
<p><input type="text" id="password" style="width:250px; height:30px;" placeholder="请输入密码"></p>
<input type="button" value="登录" style="margin-left: 20px;width: 50px;height: 30px;" onclick="myclick()">
<input type="reset" id="" value="重置" style="margin-left: 60px; width: 50px;height: 30px;">
</div>
</div>
</div>
</form>
</body>
</html>
html做的登入界面,符合要求但是为什么不能跳转呢
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- CSDN专家-showbo 2021-06-20 23:02关注
documnent.getElementById("form").submit()
document打错了
==》
document.getElementById("form").submit()
帮助到你能点个采纳吗,谢谢~~
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 3无用
悬赏问题
- ¥500 52810做蓝牙接受端
- ¥15 基于PLC的三轴机械手程序
- ¥15 多址通信方式的抗噪声性能和系统容量对比
- ¥15 winform的chart曲线生成时有凸起
- ¥15 msix packaging tool打包问题
- ¥15 finalshell节点的搭建代码和那个端口代码教程
- ¥15 Centos / PETSc / PETGEM
- ¥15 centos7.9 IPv6端口telnet和端口监控问题
- ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
- ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录