jQuery会员注册页面表单验证代码
工具/原料
adobedreamweaver
方法/步骤
1、新建html文档。
2、书写hmtl代艨位雅剖码。<header><ahref="#"c造婷用痃lass="logo"></a><divclass="desc">欢迎注册</div></header><section><formaction=""><divclass="register-box"><labelfor="username"class="username_label">用户名<inputmaxlength="20"type="text"placeholder="您的用户名和登录名"></label><divclass="tips"></div></div><divclass="register-box"><labelfor="username"class="other_label">设置密码<inputmaxlength="20"type="password"placeholder="建议至少使用两种字符组合"></label><divclass="tips"></div></div><divclass="register-box"><labelfor="username"class="other_label">确认密码<inputmaxlength="20"type="password"placeholder="请再次输入密码"></label><divclass="tips"></div></div><divclass="register-box"><labelfor="username"class="other_label"><span>中国0086∨</span><inputclass="phone"maxlength="20"type="text"placeholder="建议使用常用手机"></label><divclass="tips"></div></div><divclass="register-box"><labelfor="username"class="other_label">验证码<inputmaxlength="20"type="text"placeholder="请输入验证码"></label><spanid="code"></span><divclass="tips"></div></div><divclass="arguement"><inputtype="checkbox"id="xieyi">阅读并同意<ahref="#">《用户注册协议》</a><ahref="#">《隐私政策》</a><divclass="tips"></div></div><divclass="submit_btn"><buttontype="submit"id="submit_btn">立即注册</button></div></form></section>
3、书写css代码跷孳岔养。/*重置默认的外边距和内边距*/*{margin:0;padding:0;魈胺闹臣}/*常用标签的样式重置*/i{font-style:normal;}a{text-decoration:none;}input{outline:none;border:none;}/*设定html和body的宽度为100%*/html,body{width:100%;font:14px/150%tahoma,arial,MicrosoftYaHei,HiraginoSansGB,"\u5b8b\u4f53",sans-serif;-webkit-font-smoothing:antialiased;color:#666;}/*头部*/.logo{width:160px;height:50px;background:url(../img/icon.png)no-repeat;position:absolute;top:20px;left:20px;}.desc{font-size:18px;line-height:34px;border-left:1pxsolid#ccc;position:absolute;left:200px;top:28px;padding-left:20px;font-weight:bold;}header{width:100%;height:110px;box-shadow:10px10px10pxrgba(111,111,111,.5);position:relative;}/*注册信息*//*总体布局*/form{width:400px;margin:auto;margin-top:100px;}.register-box{border:1pxsolid#ddd;margin-bottom:32px;}.register-boxlabel{height:52px;line-height:52px;padding-left:20px;display:inline-block;}.register-boxinput{width:190px;height:19px;padding-bottom:11px;padding-left:20px;padding-top:16px;font-size:14px;color:#666;font-family:"MicrosoftYaHei","HiraginoSansGB";}.register-box.tips{position:absolute;margin-top:5px;font-size:14px;color:#ccc;}/*用户名*/.register-box.username_label{word-spacing:10px;}/*密码,确认密码,*/.register-box.other_label{word-spacing:2px;}/*手机号*/.register-boxspan{display:inline-block;width:77px;height:52px;border-right:1pxsolid#ddd;}.register-box.phone{padding-left:18px;}/*验证码*/#code{display:inline-block;width:100px;height:46px;vertical-align:middle;background-color:black;font-size:25px;color:#fff;text-align:center;line-height:46px;}/*协议*/.arguement{margin-bottom:58px;}.arguementinput{vertical-align:middle;}.arguementa{color:#38f;text-decoration:none;font-size:12px;}/*提交按钮*/.submit_btnbutton{width:100%;height:54px;color:#fff;background:#e22;border:0;font-size:16px;font-family:"MicrosoftYaHei","HiraginoSansGB";}
4、书写并添加js代码。<scriptsrc="libs/jquery-1.12.4.min.js"charset="utf-8"></script><scriptsrc="js/index.js"charset="utf-8"></script>
5、代码整体结构。
6、查看效果。