The click Method


The click Method

Calling an object's click method is almost the same as triggering a click event for the objectbefore Netscape Navigator 4.0 and Internet Explorer 4.0; however, this method did not call the object's onclick event handler. You can see the support for this method in Table 6.12.

Table 6.12. The click Method

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

click()

x

x

x

x

x

x

x

x

x

x

 

No return value

Here's an example; in this case, when you click the second button in this page, the first button's onclick event is triggered:

(Listing 06-04.html on the web site)
 <HTML>      <HEAD>          <TITLE>Using the click Method</TITLE>          <SCRIPT LANGUAGE="JavaScript">              <!--  function alerter()   {   alert("You clicked the button!")   }   function clicker()   {   document.form1.button1.click()  }              // -->          </SCRIPT>      </HEAD>      <BODY>          <H1>Using the click Method</H1>          <FORM NAME="form1">  <INPUT TYPE="BUTTON" NAME="button1" ONCLICK="alerter()" VALUE="Click Me!">   <INPUT TYPE="BUTTON" ONCLICK="clicker()" VALUE="Click the Other Button!">  </FORM>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net