How to create drop-down menu?
Let’s start, I’ll show you 2 examples, first one will allow only to chose something from the options list, second one will allow you to choose an option and be redirected to the page (where you’ll be able to represent something), you can see both methods in work here.
Add following HTML code to your website’s code:
<select id=”Select” name=”Select”>
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
<option>option5</option>
</select>
<script language=”JavaScript”>
<!–
function goToURL(form)
{
var myindex=form.dropdownmenu.selectedIndex
if(!myindex==””)
{
window.location.href=form.dropdownmenu.options[myindex].value;
}
}
//–>
</script>
<form name=”form1″>
<select name=”dropdownmenu” size=1 onChange=”goToURL(this.form)”>
<option selected value=””>choose your favorite search engine</option>
<option value=”http://google.com”>Google</option>
<option value=”http://msn.com”>MSN</option>
<option value=”http://yahoo.com”>YAHOO</option>
<option value=”http://aim.com”>AIM</option>
</select></form>