资讯专栏INFORMATION COLUMN

用js验证手机号码格式是否正确

canopus4u / 855人阅读

摘要:记录一下在之前工作中遇到的手机号码验证的一个问题,主要是用正则表达式来判断手机号是否输入正确。下面附上代码,已经实现过的。

记录一下在之前工作中遇到的手机号码验证的一个问题,主要是用正则表达式来判断手机号是否输入正确。下面附上代码,已经实现过的。

    
    
        
        
        用户注册
        
    
    
        
用户注册

css样式

@charset "UTF-8";

/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2016-11-08 17:38:55
 * @version $Id$
 */

html,body {
    font-family: Helvetica, "microsoft yahei";
    margin: 0px;
    padding: 0px;
}

input,textarea {
    -webkit-user-modify: read-write-plaintext-only;
    -webkit-appearance: none;
    outline: none;
    -webkit-tap-highlight-color:rgba(0,0,0,0);
}

ul {
    list-style: none;
    margin: 0px;
    padding: 0px;
}

a{
    text-decoration: none;
    
}
.clear{
    clear: both;
}
.hidden {
    visibility: hidden;
}

::-webkit-input-placeholder {
    /* WebKit browsers */
    color: #c0c0c0;
}

:-moz-placeholder {
    /* Mozilla Firefox 4 to 18 */
    color: #c0c0c0;
}

::-moz-placeholder {
    /* Mozilla Firefox 19+ */
    color: #c0c0c0;
}

:-ms-input-placeholder {
    /* Internet Explorer 10+ */
    color: #c0c0c0;
}

/**头部样式**/
.header{
    width: 100%;
    background: #2cc2ff;
    height:94px;
}
.mainheader {
    width: 664px;
    margin: 0 auto;
    height: 36px;
    padding: 29px 28px 29px 28px;
}
.closeicon{
    float: left;
    width: 36px;
    height:36px;
}
.closeicon img {
    width: 36px;
    height: 36px;
}
.mainheader .title{
    font-size: 34px;
    color: #ffffff;
    height: 36px;
    line-height: 36px;
    width: 664px;
    text-align: center;
    letter-spacing: 4px;
    float: left;
}


.login{
    width: 720px;
    margin: 0 auto;
    padding-top: 50px;
}
.mainlogin{
    width: 80%;
    margin: 0 10%;
}
.account,.password{
    width: 100%;
    height:94px;
    border-radius: 8px;
    border: 1px solid #a6dfff;
    line-height: 100px;
}

.account input, .password input {
    font-size: 28px;
    font-family: Helvetica, "microsoft yahei";
    outline: none;
    border: 0px;
    width: 75%;
    margin-left: 3.3%;
}
.cellphone_error, .getcode_error{
    color: #f60000;
    font-size: 20px;
    height: 56px;
    line-height: 56px;
}
.loginbtn{
    width: 100%;
    height:94px;
    font-size: 28px;
    font-family: Helvetica, "microsoft yahei";
    color: #fff;
    outline: none;
    border: 1px solid #2cc2ff;
    border-radius:96px;
    letter-spacing: 2px;
    background: #2cc2ff;
    line-height: 100px;
 
}

.forgetpsd {
    font-size: 28px;
    height: 28px;
    line-height: 28px;
    color: #ffae00;
    float: right;
    margin-bottom: 25px;
}

.quklog_register {
    margin-top: 40px;
    /*margin-bottom: 198px;*/
    font-size: 28px;
    color: #8e8e8e;
}

.quklog_register a {
    color: #2cc6ff;
    font-size: 28px;
    text-decoration: none;
}

.goregister {
    float: right;
}

.loadingDiv{
    position:absolute;
    background:#000;
    background-size: 100% 100%;
    opacity:0.5;
    filter:alpha(opacity=50);
    top:0;
    right: 0;
    left:0;
    bottom: 0;
    margin:auto;
    z-index:10000;
}
.loadingImg{
    position:absolute;
    width:57px;
    height: 57px;
    top:420px;
    right: 0;
    left:0;
    bottom: 0;
    margin:0 auto;
    z-index:10000;
    cursor: wait;   
    background:url(../images/loading2.gif) no-repeat scroll 5px 10px; 
}

.otherway { 
    width: 588px;
    height: 20px;
    position: relative;
    margin:0 auto;
    margin:0 auto;
}

.line {
    width: 588px;
    height: 1px;
    background: #D9EBFF;
}

.methods {
    position: absolute;
    top: -50%;
    left: 30.1%;
    color: #c0c0c0;
    background: #ffffff;
    font-size: 20px;
    height: 20px;
    line-height: 20px;
    width: 232px;
    text-align: center;
}

.mode {
    width: 384px;
    height: 48px;
    margin: 0 auto;
    margin-bottom: 172px;
    margin-top:38px;
}


.account_error,
.password_error {
    color: #f60000;
    font-size: 20px;
    margin-left: 66px;
    height: 56px;
    line-height: 56px;
}

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/84311.html

相关文章

  • js插件使:jQuery-Validate 表单验证插件的使

    摘要:使用下载后包中的或者就是简体中文的消息语言包引入和开始使用默认校验规则必须输入的字段。使用方法调用验证输入值。日期校验出错,慎用。必须输入合法的信用卡号。输入拥有合法后缀名的字符串上传文件的后缀。 业务上需要进行验证判断,感觉一个一个写太麻烦,于是乎在网上搜索到jQuery-Validate这个表单插件 首先需要引入jquery包 在https://jqueryvalidation....

    wenyiweb 评论0 收藏0
  • js验证身份证号码记录

    摘要:中华人民共和国居民身份证验证规则如下号码的结构公民身份号码是特征组合码,由十七位数字本体码和一位校验码组成。排列顺序从左至右依次为六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码。 在一些需要填写身份证的表单网页中,需要对身份证的输入做一个验证,于是,我记录下了自己写的验证。在写验证之前,我们需要理解身份证的一些常识规则。中华人民共和国居民身份证验证规则如下: 1.号...

    KitorinZero 评论0 收藏0
  • 重构 - 设计API的扩展机制

    1.前言 上篇文章,主要介绍了重构的一些概念和一些简单的实例。这一次,详细的说下项目中的一个重构场景--给API设计扩展机制。目的就是为了方便以后能灵活应对需求的改变。当然了,是否需要设计扩展性这个要看API的需求。如果大家有什么建议,欢迎评论留言。 2.扩展性表现形式 2-1.prototype 这个可以说是JS里面最原的一个扩展。比如原生JS没有提供打乱数组顺序的API,但是开发者又想方便使用...

    Lowky 评论0 收藏0
  • JS正则表达式验证

    摘要:验证是否含有等字符验证汉字验证地址验证验证电话号码正确格式为,,,,,。验证身份证号位或位数字验证一年的个月正确格式为和验证一个月的天正确格式为和。 Js代码 function SubmitCk() { var reg = /^([a-zA-Z0-9]+[_|\_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|.]?)*...

    xi4oh4o 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<