HTML CSS Reference/HTML Tag Reference/input

Материал из Web эксперт
Перейти к: навигация, поиск

"input" Example

    
<html>
<head>
<title>input element example</title>
</head>
<body>
    <form name="form2" method="post" action="">
        <p>This is a form with several input elements.</p>
        <input type="text" name="textfield2" value="This is a text field" size="30">
        <br>
        <input type="checkbox" name="checkbox2" value="checkbox">A checkbox.
        <br>
        <input type="radio" name="radiobutton" value="radiobutton1">
        <input type="radio" name="radiobutton" value="radiobutton2">A set of radio buttons.
        <br>
        <input type="button" name="myButton2" value="Submit">A submit button.
        <br>
        <input type="button" name="myButton2" value="Reset">A reset button.
        <br>
        <br>
        <input type="image" 
               border="0" 
               name="imageField" 
               src="yourImage.jpg" width="300"height="225" alt="An input image">
    </form>
</body>
</html>



"input" Syntax and Note

Note:
This element gathers information and send it to a server.
All <input> elements must be placed within the <form> element.
The <input> element"s type attribute is its most important attribute 
The <input> element"s type attribute determines control type
Button               Creates a button on the page.
--------------------------------------------------------------------------------------
Checkbox             Creates a checkbox.
--------------------------------------------------------------------------------------
File                 Creates a text box with a file browse button. 
                     The text box allows a user to select a file to upload to the 
                     server for processing.
--------------------------------------------------------------------------------------
Hidden               Stores information that is not visible on the web page. 
                     However, this information can be viewed in the source HTML code.
--------------------------------------------------------------------------------------
Image                An image that will submit the contents of its form to 
                     the server when it is clicked.
--------------------------------------------------------------------------------------
Password             A text box that displays an asterisk 
                     (or other placeholder character) in place of each character.
--------------------------------------------------------------------------------------
Radio                A radio button on the page. 
                     Each radio button must 
                     have the same value for its name attribute.
--------------------------------------------------------------------------------------
Reset                A button on the page. This button will reset the original 
                     values of the form.
--------------------------------------------------------------------------------------
Submit               A button on the page. This button will submit the contents 
                     of the form to the server for processing.
--------------------------------------------------------------------------------------
Text                 A text box.
    
Syntax:
    
<input attributes events>