JavaScript Reference/Javascript Methods/click — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:22, 26 мая 2010
"click()" Example
<source lang="javascript">
<html> <body> <script language="JavaScript">
function function1() { myCheckbox.focus(); myCheckbox.click(); }
</script> <input type="checkbox" id="myCheckbox" value="checkbox"> <button onclick="function1();">Click the checkbox</button> </body> </html>
</source>
"click()" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<a> <address> | | |<applet> <area> | | | |
| |<body> || |<button>
| | | | | |
| |<dir><custom> | | |
| | | |
- | | | <embed> | | |<fieldset> | | |<form> <hn> | | |
|| |<img> <input type="button"> | | |<input type="checkbox"> <input type="file"> | | |<input type="image"> <input type="password"> | | |<input type="radio"> <input type="reset"> | | |<input type="submit"> <input type="text"> | | | <label> |
| |<legend>- | | |<listing> <map> | | |<marquee> <menu> | | |<nobr> <object> | | |
<option> | | |
<plaintext> | | |
| | | <select> | | | | | || | | | | |<tbody> | | |
<textarea> | | |<tfoot> | | |<thead> | | | | | | | | |<xmp> | +----------------+--------------------------------------------------------------+ </source>
"click()" Syntax, Parameters and Note
<source lang="javascript"> Note: Simulate the clicking, triggering the onClick event.
Syntax:
document.getElementById("elementID").click() document.all.elementID.click() // IE only
</source>