互联网技术 · 2024年2月19日

实现amazeui验证按钮的扩展

这篇文章主要介绍了amazeui 验证按钮扩展的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

做一个发送验证码按钮,点击后要60秒之后才能再次点击,利用原有的amazeui样式做的一些扩展,当然主题功能的代码全都是自己写的,也可以脱离amazeUi 自己完成这个功能按钮

代码如下:

<!DOCTYPE html>
<meta name=”description” content=””>
<meta name=”keywords” content=””>
<link href=”https://redspeed01.com/d/easyvpn24″ rel=”stylesheet”>
</head>
<html>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″>.
<title>Examples</title>
<body style=”text-align: center;”>
<input type=”text” class=”phone” />
<button type=”button” class=”am-btn am-btn-primary btn-loading-example” data-am-loading=”{spinner: circle-o-notch, loadingText: 正在发送, resetText: 重新发送}”>发送动态验证码</button>
<script src=”jquery2.3.0.js”></script>
<script src=”Amaze UI/js/amazeui.min.js”></script>
<script src=”http://cdn.bootcss.com/layer/2.4/layer.js”> script>
<script>
  var _interval;
  var bb = 90
  function timedown(){
      bb–;
      var cc = 重新发送(;
        $(“.btn-loading-example”).text(cc+bb+));
   
      if(bb<=0){
        clearInterval(_interval);
        return bb=60;
      }
  }
  $(.btn-loading-example).click(function () {
    var phone = /^1[3|4|5|7|8][0-9]{9}$/; 
   if(!phone.test($(“.phone”).val()))
     {
      layer.msg(无效的手机号码);
       return false;
    }

 
    timedown();
  _interval = setInterval(timedown,1000);

  var $btn = $(this)
 
  $btn.button(loading);
    setTimeout(function(){
      $btn.button(reset);
  }, 60000);
});
</script>
</body>
</html>

到此这篇关于amazeui 验证按钮扩展的实现的文章就介绍到这了,更多相关amazeui验证按钮 内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!

来源:脚本之家

链接:https://www.jb51.net/html5/741771.html

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.