CBSE Class 10 Computer Applications Question 11 of 56

Forms and Frames — Question 3

Back to all questions
3
Question

Question 3

In the examination, Suparna has been asked to write the code for placing a drop-down list in the form area. She is also asked to indicate any one of the menu items as preselected. Help her in solving the problem.

Answer

Suparna can use the selected attribute with the <OPTION> tag to indicate that one of the menu items is preselected.

Consider the following example in which the user has to select his destination. Here, the option "Chandigarh" is pre-selected.

<HTML>
<HEAD>
<TITLE>Drop-down Example</TITLE>
</HEAD>
<BODY> 
<FORM>
<P> Select your destination: </P>
<SELECT Name = "Cities">
<OPTION Selected> Chandigarh</OPTION>
<OPTION> Kolkata </OPTION>
<OPTION> Bhopal </OPTION>
<OPTION> Lucknow </OPTION>
<OPTION> Patna </OPTION>
<OPTION> Shimla </OPTION>
<OPTION> Delhi </OPTION>
<OPTION> Mumbai </OPTION>
<OPTION> Chennai </OPTION>
</SELECT>
</FORM>
</BODY>
</HTML>