Written by Mr Li2023-02-22
javascript模拟点击滑动验证码代码(JS模拟滑动验证码)
帮助手册 Article
好东西,自己留着备用,用来自动化过各种验证码!
function slide (id,classname, offsetX) {
var slider
if(classname == 'none'){
slider = document.getElementById(id);
}else{
slider = document.getElementsByClassName(classname)[0];
}
var rect = slider.getBoundingClientRect(),
x0 = rect.x || rect.left,
y0 = rect.y || rect.top,
x1 = x0 + offsetX,
y1 = y0;
var mousedown = document.createEvent('MouseEvents');
mousedown.initMouseEvent('mousedown', true, true, window, 0, x0, y0, x0, y0, false, false, false, false, 0, null);
slider.dispatchEvent(mousedown);
var mousemove = document.createEvent('MouseEvents');
mousemove.initMouseEvent('mousemove', true, true, window, 0, x1, y1, x1, y1, false, false, false, false, 0, null);
slider.dispatchEvent(mousemove);
var mouseout = document.createEvent('MouseEvents');
mouseout.initMouseEvent('mouseout', true, true, window, 0, x1, y1, x1, y1, false, false, false, false, 0, null);
slider.dispatchEvent(mouseout);
}
slide('none','nc_iconfont btn_slide', 300);//id
You may also like
You may be interested
php中的mysql_fetch_row/mysql_fetch_array/mysql_fetch_object的区分区别和使用方法
星期一, 29 7 月 2019By 99122524
1、mysql_fe...
归档
- 2023 年 9 月
- 2023 年 8 月
- 2023 年 7 月
- 2023 年 6 月
- 2023 年 5 月
- 2023 年 4 月
- 2023 年 3 月
- 2023 年 2 月
- 2022 年 11 月
- 2022 年 10 月
- 2022 年 1 月
- 2021 年 12 月
- 2021 年 10 月
- 2021 年 7 月
- 2021 年 4 月
- 2021 年 3 月
- 2021 年 2 月
- 2020 年 11 月
- 2020 年 10 月
- 2020 年 5 月
- 2020 年 4 月
- 2020 年 3 月
- 2020 年 2 月
- 2020 年 1 月
- 2019 年 12 月
- 2019 年 11 月
- 2019 年 10 月
- 2019 年 8 月
- 2019 年 7 月
Calendar
一 | 二 | 三 | 四 | 五 | 六 | 日 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |