我使用Greasemonkey的简单点击代码,但这只是点击按钮。
我的代码
setTimeout(function() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
var link = document.querySelector("span.delete");
link.dispatchEvent(evt);
}, 0);
此代码只删除一个事件:(
页面来源
<div class="o_down">
<span class="delete">Delete</span><input type="hidden" value="50203831" /><div class="cb"></div>
</div>
<div class="o_down">
<span class="delete">Delete</span><input type="hidden" value="50203836" /><div class="cb"></div>
</div>
<div class="o_down">
<span class="delete">Delete</span><input type="hidden" value="50203838" /><div class="cb"></div>
</div>
答案 0 :(得分:-1)