Home / code / html

The input-element.

There are different types of insert.

Type Text

In code:
<INPUT TYPE="text">
example:


The attribute NAME
Gives the name of the input.
<INPUT TYPE="text" NAME="thename">

The attribute SIZE.
Gives the length of the input-area, (what you see).
<INPUT TYPE="text" NAME="thename" SIZE="25">

The attribute MAXLENGTH.
This is the maximum number of characters you can type in.
<INPUT TYPE="text" NAME="thename" SIZE="25" MAXLENGTH="23">

The attribute VALUE.
The text in the input area when the page loads.
<INPUT TYPE="text" NAME="thename" SIZE="25" MAXLENGTH="23" VALUE="Type here your text">

Type Password

All character are shown as **** .
You can add the same attributes as in text.
In code:
<INPUT TYPE="password">
Example:

Type checkbox

Here you have box that you can check, if checked the value will be send.
With this type you can check several boxes.
In code:
<INPUT TYPE="checkbox">
Example :
Check 1: Check 2: Check 3:

The attribute NAME
Gives the name of the input.
<INPUT TYPE="checkbox" NAME="thename[]">

The attribute VALUE.
This is the value that will be send through.
<INPUT TYPE="checkbox" NAME="thename[]" VALUE="This Will Be Send Through">

The attribute CHECKED
This will check the box when the page.
<INPUT TYPE="checkbox" NAME="thename[]" VALUE="This Will Be Send Through" checked>
Note : The [ ] are added to make it an array. This makes it easier to work with in most program languages.

Type radio

Here you have box that you can check, if checked that value will be send.
With this type you can check only one button.
In code:
<INPUT TYPE="radio" name="try" value="1">
<INPUT TYPE="radio" name="try" value="2">
<INPUT TYPE="radio" name="try" value="3">

Example :
Check 1: Check 2: Check 3:

Type RESET

This is a predefined button that resets the form.
In code:
<INPUT type="reset">
Example :


The attribute VALUE
The is the text that has to be shown on the button.
<INPUT type="reset" VALUE="The Text">

Type submit

A predefined button that will send the form.
You can also add value as with reset
In code:
<INPUT type="submit">
Example :

Type hidden

This is hidden from the surfers and cannot be changed by them.
Mostly used with Javascript and CGI-scripts.
In code:
<INPUT type="hidden" NAME="thename" VALUE="the value">

Type button

This is a button on which you can add a action(javascript)
You can also add the attribute value.
<INPUT type="button" VALUE="Text on the button" onClick="DoSomething()">

 

TOP

Latest script:

 

Books: