Can someone tell me the code to display dropdown box showing a default value as selected which can vary as per the user’s condition using script…i,e by enclosing in document.write…
Now i need to print a for loop counter variable’s value as the default selected option if a condition satisfies as shown below…
<CODE>
• <script type=“text/javascript”>
• document.write(“<SELECT NAME=\“choice\” >”)
• for (var counter=0; counter<10;counter++)
• {
• if(counter==6)
• {<!—what should be the code here to display 6 as by default selected option–>
• }
• else
• { <!-- what should be the code here to display the counter value other than 6 as an option in the dropdown box–>
• }
• }
• document.write(“</SELECT>”);
•
• </scriPT>
</CODE>