Forum Moderators: open
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('window.open()',this,0)">
<option selected>Select Day</option>
<option value="http://www.example.com/monday.html">Monday</option>
<option value="http://www.example.com/tuesday.html">Tuesday</option>
<option value="http://www.example.com/wednesday.html">Wednesday</option>
<option value="http://www.example.com/thursday.html">Thursday</option>
<option value="http://www.example.com/friday.html">Friday</option>
<option value="http://www.example.com/saturday.html">Saturday</option>
</select>
</form>
[edited by: encyclo at 12:59 pm (utc) on Feb. 27, 2007]
[edit reason] examplified, see TOS [webmasterworld.com] [/edit]
Try using firefox and typing javascript: in the URL bar. Use the jump menu and you should see some errors appearing. Let us know the error which happens when the jump menu is used.
Are you sure it's actually NOT working?
<select name="menu1" onChange="MM_jumpMenu('window.open()',this,0)">
If you execute a window.open without setting a unique id on the window, every call to this function will cause the new content to open in the same window. So when you go to the "other" pages after opening the first one, be sure to re-check this newly opened window, it may be working but doensn't appear to be because no new window is popping up.
I would advise against using a pop-up window for this very reason, but more importantly it's extremely annoying. Use pop up windows only if there is absolutely, positively, irrevokably no other way. They may seem cool "because you can" but they are not all that cool.
If you must use a new window, do it this way:
<select name="menu1" onChange="down_with_dreamweaver_MM(this)">
<script type="text/javascript">
function down_with_dreamweaver_MM(obj) {
// Define the parameters of your window.
// Never, ever ever make it unsizable,
// and you should always include scrollbars
var params = 'width=400,height=500,resizable,scrollbars';
// Set a unique id using time and date
var day = new Date();
var id = day.getTime();
// 'obj' is the select list object.
// Assuming you have a URL for the obj. value.
var ind = obj.selectedIndex;
var url = obj[ind].value;
var win = open(url,id,params);
}
</script>
Untested but pretty academic, that should work.