简单表单提交验证效果js实现
前端  /  管理员 发布于 4年前   332
<form action="url" enctype="multipart/form-data" method="post" onSubmit="return check()"> <table> <tr> <td> <input type='text' name='phone' id='phone' style='width: 25px;border: 1px solid #E5E5E5; height: 30px;border-radius: 10px;' placeholder="(必填) 请输入手机号" /> </td> </tr> <tr> <td> <input type='text' name='xmname' id='xmname' style='width: 25px;border: 1px solid #E5E5E5; height: 30px;border-radius: 10px;'placeholder="(必填) 请输入姓名" /> </td> </tr> </table> <div> <input type="submit" name="submit" value="提交" /> </div> </form> <script> function check() { re = /^1\d{10}$/ tel=document.getElementById("phone").value; if (re.test(tel)) { } else { alert("请输入正确的手机号!"); return false; } name=document.getElementById("xmname").value; if(name=="") { alert("请输入姓名!") return false; } } </script>
简单的弹窗效果:不改都能用
博主 在
hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令中评论 @路过的靓仔:cdn静态资源被墙,已修复..GGGGGGGGG 在
layui框架常用输入框介绍中评论 写的很好解决问题..路过的靓仔 在
hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令中评论 剩下好多 wait 状态的..激光豆芽 在
为什么你不能安逸?国内996为什么没有国外955香?中评论 国内现在无意义的内卷太多了..激光豆芽 在
阿里云香港服务器搭建自用vpn:Shadowsocks使用流程步骤中评论 厉害了..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号