Page 91 - 2620_Birla Open Mind C-8
P. 91
The <OPTION> tag specifies an option in the drop-down list. To add the combo box in the form, follow
the syntax as given below:
<SELECT NAME="name of the list">
<OPTION VALUE="val1"> Option 1 </OPTION>
<OPTION VALUE="val2"> Option 2 </OPTION>
<OPTION VALUE="val3"> Option 3 </OPTION>
</SELECT>>
For example:
<SELECT NAME="Stream">
<OPTION VALUE="Science"> Science</OPTION>
<OPTION VALUE="Commerce"> Commerce</OPTION>
<OPTION VALUE="Arts"> Arts </OPTION>
</SELECT>
The above code will create a dropdown list in which three options are available.
Let us create a web page to display the combo box.
<!DOCTYPE html>
<HTML>
<HEAD><TITLE>Stream</TITLE></HEAD>
<BODY>
<FORM>
Select Stream:
<SELECT NAME="Stream">
<OPTION VALUE="Science"> Science </OPTION>
<OPTION VALUE="Commerce"> Commerce </OPTION>
<OPTION VALUE="Art"> Art</OPTION>
</SELECT>
</FORM>
</BODY>
</HTML>
Let us create a web page containing login form to accept the user name and password from the user.
Code to create the Form.html is as follows:
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE> Login Form </TITLE>
#Forms in HTML5 89

