证券期货市场失信记录查询平台 js代码 模拟人工鼠标拖动

// https://neris.csrc.gov.cn/shixinchaxun/ 
var slider = document.querySelector('.verify-move-block');

// 计算滑动距离
var distance = 222; // 假设滑动距离为100px

// 创建鼠标按下事件
var mousedownEvent = new MouseEvent('mousedown', {
    bubbles: true,
    cancelable: true,
    view: window,
    clientX: slider.getBoundingClientRect().left
});

// 触发鼠标按下事件
slider.dispatchEvent(mousedownEvent);

// 创建鼠标移动事件
var mousemoveEvent = new MouseEvent('mousemove', {
    bubbles: true,
    cancelable: true,
    view: window,
    clientX: slider.getBoundingClientRect().left + distance
});

// 触发鼠标移动事件
document.dispatchEvent(mousemoveEvent);

// 创建鼠标抬起事件
var mouseupEvent = new MouseEvent('mouseup', {
    bubbles: true,
    cancelable: true,
    view: window
});

// 触发鼠标抬起事件
document.dispatchEvent(mouseupEvent);

你可能感兴趣的:(javascript,计算机外设,前端)