Questions tagged «mouseclick-event»


7
如何使用JavaScript模拟鼠标单击?
我知道这种document.form.button.click()方法。但是,我想知道如何模拟onclick事件。 我在堆栈溢出的某个地方找到了此代码,但我不知道如何使用它:( function contextMenuClick() { var element= 'button' var evt = element.ownerDocument.createEvent('MouseEvents'); evt.initMouseEvent('contextmenu', true, true, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 1, null); element.dispatchEvent(evt); } 如何使用JavaScript触发鼠标单击事件?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.