js原生60s验证码

//60s验证

    // let getCode = document.querySelector('.getCode');

    // let tel = document.querySelector('.tel');

    // let error = document.querySelector('.error');

    // let time = 60;

    // let timer;

    // getCode.onclick = function(){

    //    let name = tel.value; 

    //    if (name == "") {

    //        error.innerHTML='手机号不能为空!';

    //        setTimeout(function(){

    //        error.innerHTML='';

    //        }, 3000);

    //        return;

    //    }

    //    else {

    //    if (!(/^1[3|4|5|6|7|8|9]\d{9}$/.test(name))) {

    //      error.innerHTML='手机号格式有误.';

    //      setTimeout(function(){

    //        error.innerHTML='';

    //        }, 3000);

    //        return;

    //    }

    // }

    //  clearInterval(timer);

    //  timer = setInterval(function(){   

    //    time--;

    //    getCode.innerHTML = time + "秒后重试";

    //    getCode.style.background="url('images/login/retry.png')";

    //    getCode.disabled = true;

    //    if (time==0) {

    //        time = 60;

    //        clearInterval(timer);

    //        getCode.innerHTML = "获取验证码";

    //        getCode.disabled = false;

    //    }

    //    },1000);

    // }

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 单例模式 适用场景:可能会在场景中使用到对象,但只有一个实例,加载时并不主动创建,需要时才创建 最常见的单例模式,...
    Obeing阅读 2,154评论 1 10
  • "use strict";function _classCallCheck(e,t){if(!(e instanc...
    久些阅读 2,068评论 0 2
  • 简述JavaScript起源起源于美国的Netscape公司,原名为LiveScript,后改为JavaScrip...
    3ab670b99521阅读 3,110评论 0 0
  • 我是在迫不得已的情况下去看了《羞羞的铁拳》,国庆假期到了第六天发现自己身上都要长霉了,感觉自己也要被拉出去晒晒太阳...
    良烨阅读 342评论 0 3
  • 爱情随着婚姻而来,别忘了:结婚前燃烧着的爱情之火会随着婚姻熄灭,只留下一片荒芜忧郁的废墟。当然了结婚后的爱情也会消...
    CNBLUEone阅读 373评论 0 0