Introduction to JavaScript Forms
Forms provide a great deal of flexibility to your Web page. They allow Input and Output.
A Form is defined in the <BODY> </BODY> section of the page and begins with the FORM NAME:
| HTML/JavaScript Code | Result |
| <BODY> This is a test: <BR> <FORM NAME = "Sample"> <INPUT TYPE = "text" SIZE = "25" NAME = "input" > <BR> <INPUT TYPE = "button" VALUE = "Press here ..." onClick = "window.status = document.Sample.input.value;"> </FORM> </BODY> |
|
In the example above, the user types text into the input box and then presses the "Press here ..." button. The text entered then appears in the Status Line at the bottom of the Browser window.
NOTE: The input will be available as a variable for use in other JavaScript code.