JS实现阿里云滑动验证码

JS实现阿里云滑动验证码

//使用联通测试网址 http://upay.10010.com/npfwap/npfMobWap/bankcharge/index.html?version
function fuck10010(){
    btn=document.querySelector(".button");
    mousedown = document.createEvent("MouseEvents");
    rect = btn.getBoundingClientRect();
    x = rect.x||rect.left;
    y = rect.y||rect.top;
    w = document.querySelector(".label").getBoundingClientRect().width;
    //点击滑块
    mousedown.initMouseEvent("mousedown",true,true,window,0, 
            x, y, x, y,false,false,false,false,0,null);
    btn.dispatchEvent(mousedown);
     
    dx = 0;
    dy = 0;
    //滑动滑块
    intervaltimer = setInterval(function(){
        var mousemove = document.createEvent("MouseEvents");
        var _x = x + dx;
        var _y = y + dy;
        mousemove.initMouseEvent("mousemove",true,true,window,0, 
                _x, _y, _x, _y,false,false,false,false,0,null);
        btn.dispatchEvent(mousemove);
          
        btn.dispatchEvent(mousemove);
        if(_x - x >= w){
            clearInterval(intervaltimer);
            var mouseup = document.createEvent("MouseEvents");
            mouseup.initMouseEvent("mouseup",true,true,window,0, 
            _x, _y, _x, _y,false,false,false,false,0,null);
            btn.dispatchEvent(mouseup);
            setTimeout(function(){
console.log('拖动结束执行逻辑');
            }, 1000);
        }
        else{
            dx += parseInt(Math.random()*(209-199)+199)/33;
            console.log(x,y,_x,_y,dx);
        }
    }, 30);
}
本站所发布的资源均来源于互联网,仅限用于研究学习,不得将软件用于商业或者非法用途,否则一切后果请用户自负!如果侵犯了您的权益请与我们联系!您必须在下载后的24个小时之内,从您的手机和电脑中彻底删除。 如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请与我们联系处理!
情义源码站 » JS实现阿里云滑动验证码

发表评论