当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM click()方法
The click() method is used to simulate a mouse-click on a checkbox.
click()方法可用来模仿鼠标对checkbox的点击
checkboxObject.click() |
The following example simulates a mouse-click on a checkbox:
模仿点击:
<html> <head> <script type="text/javascript"> function clickCheckbox() { document.getElementById('check1').click() } </script> </head> <body> <form> <input type="checkbox" id="check1" /> <br /> <input type="button" onclick="clickCheckbox()" value="Click checkbox" /> </form> </body> </html> |
Simulate a mouse-click on a checkbox
模拟鼠标点击复选框