Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition) P40
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition) P40
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day P40 is a new edition of the best-selling book that started the whole HTML/web publishing phenomenon. The entire book has been revised and refined to reflect current web publishing practices and technologies. It includes extensive coverage of Cascading Style Sheets (CSS), which have become a staple in web development. You''ll have no problem learning from expert author Laura Lemay''s clear and approachable writing style. Simpl
This example creates a button that runs a function called verifydata when it`s clicked. You provide the label that appears on the button with the value attribute of Verify Data.
Unlike Submit buttons, regular buttons don`t submit the form when they`re clicked.
Hidden Form Fields
Hidden form fields are used when you want to embed data in a page that shouldn`t be seen or modified by the user. The name and value pair associated with a hidden form field will be submitted along with the rest of the contents of the form when the form is submitted. To create such a field, set the field`s type to hidden and be sure to include both the name and value attributes in your tag. Here`s an example:
Hidden form fields are generally used when data identifying the user needs to be included in a form. For example, let`s say you`ve created a form that allows a user to edit the name and address associated with her bank account. Because the user can change her name and address, the data she submits can`t be used to look up her account after she submits the form, plus there might be multiple accounts associated with one name and address. You can include the account number as a hidden field on the form so that the program on the server knows which account to update when the form is submitted.
The File Upload Control
The file control enables a user to upload a file when he submits the form. As you can see in the following code, the type for the input element is set to file:
Input
Please select a file for upload:
Figure 10.10 shows a file upload control.
Output
file:///G|/1/0672328860/ch10lev1sec3.html (8 von 9) [19.12.2006 13:49:17]
Figure 10.10. The file upload control.
If you want to use a file upload field on your form, you have to do a lot of behind-the-scenes work to get everything working. For one thing, the program specified in the action attribute of your form must be able to accept the file being uploaded. Second, you have to use the post method for the form. Third, you must set the enctype attribute of the
After you`ve created a form for uploading a file, you need a program that can process the file submission. Creating such a program is beyond the scope of this book, but all popular web programming environments support file uploads.
file:///G|/1/0672328860/ch10lev1sec3.html (9 von 9) [19.12.2006 13:49:17]
Using Other Form Controls
In addition to form controls you can create using the input element, there are three that are elements in and of themselves.
Using the button Element
A button you create using the button element is similar to the buttons you create with the input element, except that content included between the opening and closing button tags appears on the button.
Note
The button element (as opposed to the input element of type="button") is not supported by versions of Netscape prior to version 6.
You can create three different types of buttons: Submit, Reset, and Custom. The