Forum Moderators: open
I'm doing some redesign today on my homepage. I want to add drop-down menus to the bar at the top of page, which lists the following:
wedding poems,
anniversary poems,
valentine's poems, etc.
I want to have something that says:
Occasions and under occasions, i want the box to drop down and then I will list weddings, anniversaries, etc.
Can you help?
Thanks a lot
-a-
But this sounds like you're looking for the most basic kind of select box - the kind that is part of a form - and then change the page depending on what the user chooses.
This script goes in the <head> of your HTML document. It defines a function called "changepage" which your form will call, from down in the body ofn the HTML page. The page will change when someone chooses a new selection from the list.
<script type="text/javascript">
<!--
function changepage(dropdown)
{
selecteditem = dropdown.newurl.selectedIndex;
newurl = dropdown.newurl.options[ selecteditem ].value;
if (newurl.length!= 0) {
location.href = newurl;
}
}
//-->
</script>
And then this form goes in the body of your HTML:
<form action="irrelevant"><select name="newurl" onchange="changepage(this.form)">
<option value="" selected="selected">-- Occasions --</option>
<option value="weddings.html">Weddings</option>
<option value="anniversary.html">Anniversary</option>
<option value="valentines.html">Valentines</option>
</select></form>