Untitled Document



 Introduction to HTML
 Structure of HTML
 Creating First HTML  Document
 Building Your HTML  Document
 Tables
 Frames
 Including Images into  Document
 Including Multimedia
 Developing HTML  FORMS
 Anatomy of a FORM
 Developing HTML  FORMS
 Anatomy of a FORM
 Simple Form Layout
 
 Simple Form Layout
 The INPUT elements
 
   The INPUT elements
   The Button Value
   The Reset Value
   The Submit Value
   The Image Value
   The Checkbox Value
   The Radio Value
   The Hidden Value
   The Text Value
   The Password Value
   Other Attributes
 The INPUT Tags
 The BUTTON Element
 
 The BUTTON Element
 The SELECT and OPTION  Elements
 
 The SELECT and  OPTION Elements
 The TEXTAREA Element
 
 The TEXTAREA  Element
 The LABEL Element
 
 The LABEL Element
 The FIELDSET and  LEGEND Elements
 
 The FIELDSET and  LEGEND Elements
 Tab Navigation
 
 Tab Navigation
 Access Keys
 
 Access Keys
 Using Style Sheet
 Understanding URLs
 Using JavaScript
 Using Java

Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




  Developing HTML Forms > The INPUT elements

  The INPUT elements

The INPUT element is the most used element in a Form. Using this element it is possible to build a Form using no other elements due to the variety of widgets available through the type attribute.

Syntax:

<INPUT [type =text | Password | checkbox | radio | submit | image | button | hidden | file]
               [name = controlname]
               [value = controlvalue]
               [checked]
               [disabled]
               [readonly]
               [size=controlwidth]
               [maxlength = wordlength]
               [src=URL]
               [alt=alttext]
               [usemap=URL]
               [align=left|center|right|justify]
               [tabindex=tabnum]
               [accesskey=keycombo][onfocus=script][onblur=script][onselect=script]
               [onchange=script]
               [accept=charset] [core]
               [international]
               [events]>

The Button Value
The Reset Value
The Submit Value
The Image Value
The Checkbox Value
The Radio Value
The Hidden Value
The Text Value
The Password Value
Other Attributes

  The Button Value

Apart from submit and reset buttons that were available with earlier versions, HTML 4.0 allows us to define buttons using the INPUT element. The Button INPUT type has no default function; you define its function using a script.

Example:

<INPUT type = "button"
               name = "custom_button_01"
               value = "push this"
               onclick = "runprocess ()">

Note:

Name is the variable name given to the INPUT element of type Button.
Value is the text that appears on the Button.
Onclick specifies the function to be called when clicked on the button.

  The Reset Value

The Reset value for the type attribute creates a button with only one purpose: all Form entries are cleared to their default entries or left blank if no default is specified.

Example:

<INPUT type="reset"
               name = "reset"
               value = "Reset Form">

Note:

Type specifies that the input element type is a reset button.
Value provides the text to be displayed on the reset button.

  The Submit Value

The Submit value of the type attribute creates a button that like the reset button has a single purpose. This button is used to send the name/value pairs of the active Form elements to the URL specified in the FORM declaration. The HTML specification enables multiple submit buttons to exist.

Example for using single submit button:

<INPUT type ="submit"
               name = "Submit"
               value = "Submit Form">

Example for using multiple submit buttons:

<FORM ACTION = "form-processor">
your name: <INPUT NAME = "name">
<P> I have read the license and agree to abide by it. </P>
<INPUT TYPE= "SUBMIT" VALUE= "I Agree" NAME= "Choice">
<INPUT TYPE= "SUBMIT" VALUE= "I disagree" NAME= "Choice">

  The Image Value

An INPUT element with TYPE = "IMAGE" creates an image button. An image button is similar in function to a submit button except that instead of a gray button with text, an image of your choice is displayed.

Example:

<INPUT type = "image"
               src ="submit_image.gif">

Note: src specifies the path and the name of the image. The attributes for an image button are similar to the attributes of the <IMG> tag.

  The Checkbox Value

The Checkbox value of the type attribute is a boolean input device; it's either off or on. It looks like a hollow box that when selected is filled with a check mark to indicate its active state. If the user wants to make multiple selections on the same topic, you can use several check box elements with the same name and different value.

Syntax:

<INPUT type= "checkbox" name= "controlname" value= "controlvalue" [checked]>

Example:

<H3>pick your toppings:</H3>
<INPUT type = "checkbox" name= "topping" value = "cheese" checked>Cheese<BR>
<INPUT type = "checkbox" name= "topping" value = "pepperoni">Pepperoni<BR>
<INPUT type = "checkbox" name= "topping" value = " Shrooms">Mushrooms<BR>
<INPUT type = "checkbox" name= "topping" value = "clams">Smoked clams<BR>

Each checkbox that is switched on will submit a name / value pair with the same field name.

  The Radio Value

The Radio value of the type attribute is very similar to the checkbox type. The difference between the two is that radio buttons are mutually exclusive i.e. selecting one, turns off the other. The default choice is indicated using a CHECKED attribute.

Syntax:

<INPUT type= "radio" name= "controlname" value= "controlvalue" [checked]>

Example:

<H3>pick the crust</H3>
<INPUT type= "radio" name = " crust" value= "deep dish" checked>Deep Dish<BR>
<INPUT type= "radio" name = " crust" value= "hand tossed">Hand Tossed<BR>
<INPUT type= "radio" name = " crust" value= "whole wheat">Whole Wheat<BR>

Back Next


Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




17, Vadsarvala Nivas, 65-A, J. Nehru Road, Mulund (W), Mumbai - 400 080 INDIA
Tel : 91-22-25795588, 91-22-25780444 Fax : 91-22-25793397
Email : ionline@vsnl.com
© Image Online 2001-2003