Jump menu help
I am trying to get the links in a jump menu to open in a blank page. My code works fine if i leave the bit that says 'parent' but when i change this to 'blank' the links don't work.
Here is the code:
Yapp Brothers Wine Merchants
Hill Brush Company Ltd
Mere Library
Conundrum
Hope this is do-able coz it's driving me nuts.
kazimmerman posted this at 18:43 — 25th October 2007.
He has: 698 posts
Joined: Jul 2005
I feel as if some Javascript is missing from your code (in fact, I'm assuming this isn't your entire HTML code. Perhaps if you could copy and paste the rest or give us a direct link to the page, we could help modify the code you're working with.
On the other hand, to open in a new window, you can use a code like this:
<form name="form" id="form">
<select name="jumpMenu" size="1" id="jumpMenu">
<option value="http://www.yapp.co.uk/" selected="selected">Yapp Brothers Wine Merchants</option>
<option value="http://www.hillbrush.com/index.htm">Hill Brush Company Ltd</option>
<option value="http://www.southwilts.co.uk/site/Mere-Library/">Mere Library</option>
<option value="http://www.conundrumtheshop.co.uk/">Conundrum</option>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="window.open(form.jumpMenu.value,'parent',0)" />
</form>
You can find more information about the 'window.open' Javascript function at W3's tutorial page:
http://www.w3schools.com/htmldom/met_win_open.asp
Kurtis
teeandee posted this at 09:12 — 26th October 2007.
They have: 4 posts
Joined: Sep 2006
Just tried out your code, works a treat. Thanks mate.
kazimmerman posted this at 12:40 — 26th October 2007.
He has: 698 posts
Joined: Jul 2005
Not a problem. I am curious though: is the original code you had something you found online/downloaded, and if so, could you post a link to it? If you wrote it, could you post the rest of the code? I'm curious what is actually happening in the MM_jumpMenuGo() function.
Kurtis
Greg K posted this at 14:06 — 26th October 2007.
He has: 2,145 posts
Joined: Nov 2003
MM_whatever functions are usually js functions that Dreamweaver auto inserts for certain web features. In this case, in Dreamweaver there is a button on the toolbar to open up an editor to make a jump menu for you, so you don't actually have to hand code the thing.
Here is the code for the MM_jumpMenu:
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
Here is the other two functions that go with it:
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;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
-Greg
kazimmerman posted this at 16:47 — 26th October 2007.
He has: 698 posts
Joined: Jul 2005
Aah. I figured it was some sort of generated code, but I was curious exactly how they were going about it.
teeandee posted this at 10:59 — 1st November 2007.
They have: 4 posts
Joined: Sep 2006
Code was generated in Dreamweaver. Haven't uploaded it to the site yet as it's still under construction but if you're really interested the url is merewilts.org Having a few probs with css display and ie6. Any tips will be gratefully received (still a code numpty). Still getting my head around css after working with tables for years. Ahh halcyon days, it was all so simple then.
And another thing while I'm here, why is it when positioning with css I can set the positions of things which look fine in IE7 but slightly out in Firefox?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.