<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>秒杀</title>
</head>
<body>
<button οnclick="a()">我不是</button>
<input οnclick="a()" type="button" value="我不是a">
<button οnclick="b()">我不是</button>
<button οnclick="c()">我不是</button>
<button οnclick="d()">我不是</button>
<button οnclick="submit('button')">秒杀</button>
<input οnclick="submit('input')" type="button" value="秒杀">
<script>
var button = document.querySelectorAll('button');
setInterval(function () {
for (var i = 0; i < button.length; i++) {
//可以根据页面元素设置
if (button[i].value == "秒杀"||button[i].innerHTML=="秒杀") {
button[i].click();
}
}
}, 10)
// var inputbtn = document.querySelectorAll('input[type="button"]');
// setInterval(function () {
// for (var i = 0; i < inputbtn.length; i++) {
// //可以根据页面元素设置
// if (inputbtn[i].value == "秒杀") {
// inputbtn[i].click();
// }
// }
// }, 10)
function a() {
console.log('a')
}
function b() {
console.log('b')
}
function c() {
console.log('c')
}
function d() {
console.log('d')
}
function submit(type) {
console.log('抢'+type)
}
</script>
</body>
</html>
秒杀抢年货啦
最新推荐文章于 2022-01-07 14:04:56 发布