HTML Forms
Form is typically a layout of the web page by which a
user can interact with the web page. Typical contents of the form are Text,
Text area, checkboxes radio buttons, push buttons. All the form contents appear
in the <form> tag
Text
Text is typically required to place one line text , for
example if you want to enter some name it is always preferred to have Text
field. The text field can be set
using
<input type=”text” size=”30” value=””>
Here input type is text and value displayed is blank.
Example:
<body>
<form>
<b>Input String:</b>
</br>
<input type=”text” size=”30” value=” “>
</form>
</body>
Some other parameters can be
- maxlength that allows us to enter text of some maximum length.
- names indicate name of the field.
- align denotes alignment of text in the text field.
Checkbox
It is the simplest component which is used particularly
when we want to make selection from several options.
<body>
<form name=”checkbox”>
Select the fruit u love </br>
<input type=”checkbox” name=”option1” value=”mango” checked=”checked”>Mango</br>
<input type=”checkbox” name=”option2” value=”apple” >Apple</br>
<input type=”checkbox” name=”option3” value=”banana”>Banana</br>
</form>
</body>
Radio Button
It is the simplest component and similar to checkbox which
is used particularly when we want to make selection from several options.
<body>
<form name=”radiobutton”>
Select the fruit u love </br>
<input type=”radiobutton” name=”option1” value=”mango” checked=”checked”>Mango</br>
<input type=”radiobutton” name=”option2” value=”apple” >Apple</br>
<input type=”radiobutton” name=”option3” value=”banana”>Banana</br>
</form>
</body>
Buttons
There are two types of button that can be created in
HTML. One is called submit button
and another is called reset button.
Various parameters of submit button are :
- name denotes the name of submit button.
- value is for writing some text on text on the button.
- align specifies alignment of the button.
example:
<body>
<form name=”myform” method=”post”>
<input type=”submit” value=”Send”>
<input type=”Reset” value=”Reset”>
</form>
</body>
MENU:
HTML allows us to have pop down menu on the web page so
that the desired selection can be made. The parameter select is for the menu component and option parameter is for setting
the values to the option of drop down menu.
We can make some specific option selected by selected
value = .
example
<form>
<select menu=”My Menu”>
<option value=”Mango”>Mango </option>
<option value=”apple”>Apple </option>
<option value=”banana”>Banana </option>
<option value=”grapes”>Grapes </option>
</select>
</form>
No comments:
Post a Comment