<class home>  <forms>   <back   next>

Jump Menus

Jump menus are a list that takes a user to a URL when they have selected an item from the list. A "go" button is optional. You would use this if you want the user to make a selection and then have them choose the "go" button to go. Otherwise a user will just be sent to the url when they pull down to the option.


ex.


To make a menu: Dreamweaver

1. Put your cursor where you want it in the document window.

2. Select Insert>form object>Jump Menu from the main menu.
Or click on the form button in the object panel: form section:

3. In the dialog box :
-enter in menu items names in the "Text" area
-enter in a URL for the page to go to when this is selected
-choose the window
-name your menu
-select "insert a go button" to add a go button (optional)
-select the "select first item after URL change" to have it go back to the first item it you return (optional)

*note: open URLs In: window options appear to be only parent window or you can select frames, but not a blank new window (see example of custom script below to open the URL in a new window).

-use "+" to add more
-use the arrow keys to shuffle order
-use the "-" sign to remove.

4. In the Properties panel:
You will see the same options that you would for a list item if you select the list and button options for the button.

*note: Javascript is on the list and on the go button. So, basically the URL change still happens if you pull down to the selection.

Really the go button is a bit of a mystery within Dreamweaver because it doesn't work as it should.
To make it work, try the following script instead:

script:

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;

window.open(URL);
}
// End -->
</SCRIPT>
</head>
<body>
<center>
<form name="form">
<select name="site" size=1>
<option value="">Go to....
<option value="http://www.yahoo.com">Yahoo
<option value="http://www.metacrawler.com">Metacrawler
<option value="http://www.altavista.digital.com">Altavista
<option value="http://www.webcrawler.com">Webcrawler
<option value="http://www.lycos.com">Lycos
<option value="http://javascript.internet.com">JavaScript Source
</select>
<input type=button value="Go!" onClick="javascript:formHandler(this)">
</form>
</center>
</body>
</html>


In HTML

This uses a function in the head section to work. It is much more complicated than some of the former examples.

code:
In head:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//-->
</script>


In body:

<form name="form5" method="post" action="">
<p>
<select name="select" onChange="MM_jumpMenu('parent',this,0)">
<option value="http://www.google.com" selected>google</option>
<option value="http://www.yahoo.com">yahoo</option>
<option value="http://www.altavista.com">altavista</option>
</select>

</p>
</form>