日期:2014-05-17  浏览次数:20646 次

HTML form包含的元素

?

HTML form elements

Object HTML tag type property Description and events
Button <input type="button"> or <button type="button"> "button" A push button; onclick
Checkbox <input type="checkbox"> "checkbox" A toggle button without radio-button behavior; onclick
FileUpload <input type="file"> "file" An input filed for entering the name of a file to upload to the web server; onchange
Hidden <input type="hidden"> "hidden" Data submitted with the form but not visible to the user; no event handlers
Option <option> none A single item within a Select object; event handlers are no the select object, not on individual Option objects
Password <input type="password"> "password" An input filed for password entry--typed characters are not visible; onchange
Radio <input type="radio"> "radio" A toggle button with radio-button behavior--only on selected at a time; onclick
Reset <input type="reset"> or <button type="reset"> "reset" A push button that resets a form; onclick
Select <select> "select-one" A list or drop-down menu from which one item may be selected; onchange
Select <select multiple> "select-multiple" A list from which multiple items may be selected; onchange
Submit <input type="submit"> or <button type="submit"> "submit"

A push button that submits a form; onclick

Text <input type="text"> "text" A single-line text entry field; onchange
Textarea <textarea> "textarea" A multiline text entry filed; onchange

?

An HTML form containing all form elements

<form name="everything">                   <!-- A one-of-everything HTML form... -->

 <table border="border" cellpadding="5">   <!-- in a big HTML table -->

   <tr>

     <td>Username:<br>[1]<input type="text" name="username" size="15"></td>

     <td>Password:<br>[2]<input type="password" name="password" size="15"></td>

     <td rowspan="4">Input Events[3]<br>

       <textarea name="textarea" rows="20" cols="28"></textarea></td>

     <td rowspan="4" align="center" valign="center">

       [9]<input type="button" value="Clear" name="clearbutton"><br>

       [10]<input type="submit" name="submitbutton" value="Submit"><br>

       [11]<input type="reset" name="resetbutton" value="Reset"></td></tr>

   <tr>

     <td colspan="2">

       Filename: [4]<input type="file" name="file" size="15"></td></tr>

   <tr>

     <td>My Computer Peripherals:<br>

       [5]<input type="checkbox" name="peripherals" value="modem">56K Modem<br>

       [5]<input type="checkbox" name="peripherals" value="printer">Printer<br>

       [5]<input type="checkbox" name="peripherals" value="tape">Tape Backup</td>

     <td>My Web Browser:<br>

       [6]<input type="radio" name="browser" value="nn">Netscape<br>

       [6]<input type="radio" name="browser" value="ie">Internet Explorer<br&