jQuery扩展+xml实现表单验证功能的方法(2)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>表单验证</title> =====引入=======表单验证 js </head> <body> <!-- 锚点 --> <a></a> <!-- 锚点 --> <div> <div> <div>机构用户注册</div> <div>我已经注册,现在就<a href="https://www.jb51.net/zzlc/jsp/login/login.jsp">登录</a></div> </div> <!-- 表单开始 --> <form method="post" action="/userregister.go"> <div> <span>机构简称:</span> <div> <input disabled="disabled" autocomplete="off" type="text" /> <input type="hidden" autocomplete="off"/> </div> <p></p> </div> <div> <span>组织机构代码:</span> <div> <input disabled="disabled" autocomplete="off" type="text" /> <input type="hidden" autocomplete="off"/> <a></a> </div> <p></p> </div> <div> <span>机构类别:</span> <div > <input disabled="disabled" autocomplete="off" type="text"/> <input type="hidden" autocomplete="off"/> </div> <p></p> </div> <div> <span>注册地址:</span> <div> <input disabled="disabled" autocomplete="off" type="text" /> <input type="hidden" autocomplete="off"/> </div> <p></p> </div> <h3>个人信息</h3> <div> <span><b>*</b>登录名:</span> <div> <input fun="_loginname" value="wangjunadmin" must="true" type="text" /> </div> <p></p> </div> <input value="" type="hidden"></input> <div> <span><b>*</b>登录密码:</span> <div> <input autocomplete="off" value="" type="password" fun="_firstpwd" must="true" /> </div> <p></p> </div> <div> <span><b>*</b>密码确认:</span> <div> <input md5="" autocomplete="off" value="" fun="_secondpwd" must="true" type="password" /> </div> <p></p> </div> <div> <span><b>*</b>姓名:</span> <div> <input value="" must="true" type="text" /> </div> <p></p> </div> <div> <span><b>*</b>性别:</span> <div> <input type="hidden" value="男"/> <select> <option value="1">男</option> <option value="2">女</option> </select> </div> <p></p> </div> <div> <span><b>*</b>电话:</span> <div> <input must="true" value="010-888888888" fun="_tel" type="text" /> </div> <p></p> </div> <div> <span><b>*</b>手机:</span> <div> <input must="true" value="18610740826" fun="_phone" type="text" /> </div> <p></p> </div> <div> <span><b>*</b>电子邮箱:</span> <div> <input fun="_email" value="wj_dreamfly@163.com" must="true" type="text" /> </div> <p></p> </div> <div> <span><b>*</b>联系地址:</span> <div> <input type="text" value="朝阳区" must="true" /> </div> <p></p> </div> <div> <span><b>*</b>部门:</span> <div> <input type="text" value="信息部" must="true" /> </div> <p></p> </div> <div> <span><b>*</b>职务:</span> <div> <input type="text" value="开发" must="true" /> </div> <p></p> </div> <div> <span>。</span> <div> <a href="javascript:void(0)"> <span>提交</span> </a> </div> </div> </form> <!-- 表单结束 --> <a href="#aaa"></a> </div> <div></div> </body> </html> $(document).ready(function() { $("#point").click();//用锚点自动定位第一个验证失败的表单 $("#submit").click(function() {//提交按钮 $("#regform").regattrs();//注册方法自动验证表单中所有的元素 }); $("input").regattr();//失去光标时验证 $("input").prompt();//获取光标是提示信息 });

PS:这里再为大家提供几款关于xml操作的在线工具供大家参考使用:

在线XML/JSON互相转换工具:

在线格式化XML/在线压缩XML:

XML在线压缩/格式化工具:

XML代码在线格式化美化工具:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwjxwf.html