Notes: December 17th, 2007

Forms

The <form>tag is used in order to create forms in a web page. This tag allows you to add form parts to a web page. The form tag has a required property called action, which specifies where the browser will go after submitting the data. Inside of the form you can specify text as you would outside the tag, but you can also specify <input> tags. This tag has different types that you can specify, as well as a name to itentify it, initial value, and read only mode. These elements all have values that can specify the cols and rows which allows you to control their size.

<form action="">Enter something: <input name="in1" value="Information" type="text" /></form>
Enter something:

Types of Input

Text Area

<textarea name="textarea" cols="20" rows="10"></textarea>

JavaScript and Forms

Adding JavaScript in order to handle forms when submitted is easy. You add an onSubmit property to the form with "return methodName();" this will cause this method to be called when the form submits. The button inputs have onClick events as well, if you wish to do something when the button is clicked. There are many other different events that different elemetns can generate, look them up to use them.