javascript 如何使用javascript触发鼠标点击事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6582748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to trigger a mouse click event using javascript
提问by Arun
Possible Duplicate:
How can I trigger a JavaScript event click
可能的重复:
如何触发 JavaScript 事件点击
I am developing a website, i want to trigger a mouse click event to a button using java script. please can any one help me solve this problem.
我正在开发一个网站,我想使用 java 脚本触发一个按钮的鼠标点击事件。请任何人都可以帮我解决这个问题。
thanks in advance
提前致谢
回答by Sascha Galley
document.getElementById('your_button').click();
回答by Arun
document.getElementById("id of button").onclick();
document.getElementById("id of button").onclick();