Development| HTML| JavaScript| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript click method 
 

In the html page we can select the check box either by clicking on the checkbox option while selecting any option or we can call the JavaScript method click() on the checkbox object.

 

JavaScript click method

                         

In the html page we can select the check box either by clicking on the checkbox option while selecting any option or we can call the JavaScript method click() on the checkbox object. In this example we have developed an example which shows how one can select the checkbox by using the method click.

Syntax:

 CheckBoxObject.click();

Description of code:

Here in this example html code we have create three check boxes and three buttons. In these three checkboxes we have called the three different functions selectFirst(), selectSecond(), selectThird().All these three methods calls the click method with the checkbox objects.

Here is the full example source code of clickExample.html as follows:

<html>
<body>
<script language="JavaScript">
        function selectFirst() {
             checkbox1.focus(); 
             checkbox1.click();
        }
        function selectSecond() {
             checkbox2.focus(); 
             checkbox2.click();
        }
        function selectThird() {
             checkbox3.focus(); 
             checkbox3.click();
        }
</script>
       <p>&nbsp;</p>
       <p align="center">&nbsp;</p>
       <div style="background: #cf2255; width:'100%';" align="center">
       <font color="#ffffcc" size="12pt"><b>Click Example</b></font></div>
       <center>
       <p align="left">
       <input type="checkbox" id="checkbox1" value="Checkbox1">
       <button onclick="selectFirst();">Click first checkbox</button>
        </p>
        <p align="left">
        <input type="checkbox" id="checkbox2" value="Checkbox1">
        <button onclick="selectSecond();">Click second checkbox</button>
        </p>

        <p align="left">
        <input type="checkbox" id="checkbox3" value="Checkbox3">
        <button onclick="selectThird();">Click third checkbox</button>
        </p>
        </body>
</html>

Output :

Download Source Code

                         

» View all related tutorials
Related Tags: java javascript c attributes script reference object method sed remove ip attribute node move nat to ref e it alter

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.