Checkbox Object

By: aathishankaran  

The checkbox object is the form object that is best equipped to denote logical (true or false) data. It acts as a toggle switch that can be turned on or off either by the user or by your JavaScript code. To define a checkbox, use the following HTML syntax:

<INPUT TYPE="checkbox"[NAME="objectName"] [VALUE="value"] [CHECKED][onClick="methodName"]> [displayText] 

For example, the following checkbox allows users to specify their foreign language proficiencies: 

<input type=checkbox name="language"> I speak multiple languages.

Example

<Html>

<Head>

<Title>

Check box Example

</Title>

<Body>

<Hl>Example for CheckBox</Hl>

<H2>Click on the checkBox and find the status</H2>

<Hr>

<Form Name=form1>

<Center>

Server

<Input Type=CheckBox

Name=svr

onClick="

if (svr. checked)

{

alert('The status is true');

}

else

{

alert('The status is false');

}

“>

<Hr>

</Center>

</Form>

</Body>

</Html>

Output

If you check the checkbox

If you uncheck the checkbox

 




Archived Comments

1. outstanding....
View Tutorial          By: subhasish biswas at 2009-04-19 00:16:50


Most Viewed Articles (in JSP )

Latest Articles (in JSP)

Comment on this tutorial