HTML » Tags » input

Version: 2.0, 3.2, 4.0

Compability: Explorer 4, 5 Netscape 4, 6

Syntax:
<input>

The <input> tag is used to create individual form controls (fields). Control is a technical term that refers to the various elements (buttons, check boxes, radio buttons, text areas) that can be used inside a form to gather information.

The four tags that can be used to build a form are:
 
button     input     select     textarea
 
The form is the heart of an e-commerce page and the input tag is the heart of a form. There are ten types of form controls that can be created using the input tag. Appropriately, you must use the type attribute to determine the specific type of the control (field). The types are:
 
button
checkbox
file
hidden
image
password
radio
reset
submit
text
 
Any number of input tags can be placed anywhere between a pair of opening and closing form tags to create the desired appearance of the form.
 
There is no closing tag.

Examples

Code:
MY SAMPLE FORM:
<p>
<form method="post" enctype="multipart/form-data" >
<input type="button" name="btn2" value="click me" style="background-color:yellow;"> Button
<p>
<input type="checkbox" name="ckbx2" value="true"> Check Box
<p>
<input type="file" name="file2"> Attach a File
<p>
<input type="hidden" name="SocSecNum" value="123-45-6789">
<p>
<input type="password"> Password
<p>
<input type="radio" name="radio2" value="one" checked> First Radio Button
<br>
<input type="radio" name="radio2" value="two"> Second Radio Button
<br>
<input type="radio" name="radio2" value="three"> Third Radio Button
<br>
<input type="radio" name="radio2" value="four"> Forth Radio Button
<p>
<input type="text" name="submit" name="text2" size="50"> Text
<br>
<input type="text" name="submit" name="text3" size="25"> Text
<br>
<input type="text" name="submit" name="text4" size="2"> Text
<p>
<input type="reset" value="Clear The Form" style="color:white; background-color:blue;"> Reset Button
<br>
<input type="submit" name="submit" name="submit2" onclick="submitform()"
value="Submit" style="color:white; background-color:red;">
Submit Button
</form>

<script type="text/javascript">
function submitform()
{ alert("Thank You For Submitting The Form") }
</script>
Output:
MY SAMPLE FORM:

Button

Check Box

Attach a File

Password

First Radio Button
Second Radio Button
Third Radio Button
Forth Radio Button

Text
Text
Text

Reset Button
Submit Button

Language(s): HTML

See Also: