Sie sind auf Seite 1von 17

p 

p

` An HTML form provides data gathering functionality to a
web page.
` Html provides the <form>«</form> tags with which an
html form can be created to capture user input.
` Input tag: defines an input area within a form. The different
ways of input are specified by ´typeµ attribute. This attribute
can accept text, radio, checkbox, password submit, reset,
image, hidden etc as its value.
p 
` It presents the user with a prompt for a single line of text.
These fields are commonly used for a name address, email
address, country, postal code etc.
` <input type=´textµ name=´text-idµ value=´default-textµ
size=´nµ maxlegth=´mµ read only>
` Name: to label the content. This name is not visible to the user
and must be unique within the form.
` Value: to supply initial text to the txt field and is optional. The
content of this attribute will be shown on the text field, unless
the user changes it.
` Size: to specify the physical size of the text input box. The
default value is usually a length of 20 characters.
` Maxlength: to set the number of character a user can input. The default value of max
length is unlimited.
` Readonly: to lock the predefined content within the text field and the content won·t
be editable further.

<html>
<head><title>form</title></head>
<body>
<p align="center"> <b> ADMISSION FORM</b>
<form>
<p>
NAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text"
name="name" value="enter your name here" size=25 maxlength=30> <br><br>
ADDRESS:&nbsp;<input type="text" name="address" value="enter your address
here" size=25 maxlength=30><br><br>
</form>
</body>
</html>
 

` assword fields are similar to the text fields, except the
content of the field are not visible on the screen. It displays
**** instead of the actual input.
` <input type=´passwordµ name=´password-idµ
value=´default-textµ size=´nµ maxlength=´mµ readonly>
 


` These are mutually exclusive i.e. they allow the user to
choose one of the several options. Selecting one turns the
other off. These buttons are viewed in the browser as small
circles with a prompt and the selected one appears with a
solid dot in it.
` <input type=´radioµ name=´radio-idµ value=´choice-idµ
checked>
` Value: it is the value assigned by the user. Each radio button
must be assigned a value.
` Checked: causes the radio button to be on when the form is
first created.
X 

` An input tag with attribute type=´checkboxµ offers the user
an ´onµ or ´off µ switch.Each check box works independently
from the other, visitor can select or deselect any combination
of checkboxes. Use of these boxes are appropriate where
user can have more than one right answer.
` <input type=´checkboxµ name=´box-idµ value=´choice-idµ
checked>


 
` A pull down menu lets the user select one choice out of many
possible choices.
` All choices are not visible on screen, they are hidden.
` They occupy minimal amount of space.
<select name=´text-idµ size=´nµ multiple>
<option value=´choice-id1µ selected>text-label1</option>
<option value=´choice-id2µ selected>text-label2</option>
<option value=´choice-id3µ selected>text-label3</option>
</select>
Size: no. of items to be displaced at a time.
Selected: this value will be selected when 1st time page appears.

` This tag is used to set an area within a form in which the user can
type a large amount of text. This is basically used for giving
comments and free form feedback from visitor
` <textarea name=´text-idµ rows=´nµ cols=´mµ
wrap=´virtual|physically|off µ read only>INITIAL TEXT</text
area>
` Rows: specifies the height of the text area.
` Cols: this attribute specifies the width of the text area.
` Wrap: if option is off then text is handled as one long sequence of
text without line breaks. If its virtual the text appears on page as if
its recognized line breaks but when the form is submitted the line
breaks are turned off. If its set to physical then line breaks are
included.
` Readonly: it prevents the user to alter the initial content.
    

` Submit: submits the information to the URL given as the
action attribute of the form tag.
` <input type=´submitµ value=´button-labelµ>.
` Image can also be used for submit button.
` <input type=image src=path heigth=n width=m alt=text
border=0>
` Reset: clears the form enteries to the default one or leaves
them blank if no default values are specified.
` <input type=´resetµ value=´button-labelµ>.
p 
` To allow visitor to upload files.
` <input type=file name=field-id size=n >
` Size: to specify the physical size of the field·s input box.
 
` They do not appear in the displayed form. By setting the
´typeµ attribute to hidden, it is possible to transmit default or
previously specified text that is hidden from the user to the
handling program.
` <input type=hidden name=data-id value=´hidden form
dataµ>
p   
` <fieldset> tag creates a box around a group of widgets and
<legend> tag provides a label to the field set.
` Both tags require closing tag.
<body>
<fieldset>
<legend><H2>DETAILS</H2></legend>
<form>
«.
</form>
</fieldset>
</body>
 p 
` By default, we navigate through the form in order on which
elements appear in the form, using the tabindex attribute we
can change this default order.
` Access keys: provide keyboard access to the form using
accesskey attribute
<body> COUNTRY: <select name="country" size=2 multiple>
<p align="center"> <b> ADMISSION FORM</b> <option value="india" selected>INDIA
<fieldset> <option value="america">AMERICA
<legend><b>DETAILS</legend> <option value="australia">AUSTRALIA
<option value="new zealand">NEW ZEALAND
<form>
<option value="china">CHINA
<p> </select><br><br>
NAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs COMMENTS: <textarea name=´commentsµ rows=´10µ
p;&nbsp;<input type="text" name="name" value="enter cols=´10µ wrap=´physicalµ >place your text
your name here" size=25 here</textarea><br><br>
ATTACHMENTS:<input type=file name=file-name
size=10>
maxlength=30 readonly> <br><br> <br><br>
ADDRESS:&nbsp;&nbsp;&nbsp;<input type="text" <input type=hidden name=hidden-box value=´hidden form
name="address" value="enter your address here" size=25 dataµ>
maxlength=30><br><br>
ASSWORD:<input type="password" name="password-id" <input type="submit" value="DONE"><input
type="reset" value="CLEAR">
value="" size=25 maxlength=30><br><br>
<br>
GENDER: <input type="radio" name="gender"
<input type=image src=sunset.jpg heigth=100 width=100
value="male" checked> male <input type="radio" alt="text" border=1>
name="gender" value="female" >female<br><br>
OWN VEHICLE: <input type ="checkbox" name="vehicle" </form>
value="vehicle" checked><br><br> </fieldset>
HOSTEL REQUIRED: <input type ="checkbox" </body>
name="hostel" value="hostel" ><br><br>

Das könnte Ihnen auch gefallen