JavaScript Reference/Javascript Methods/click

Материал из Web эксперт
Версия от 11:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"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> |

| |
|

| | <custom> | | |

|

| |<dir>
| | |
| | | <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>                       |
      |                |                          |
      |                |                                                       |
      |                |
        | | |<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>

      <textarea> | | |<tfoot> | | |<thead>