Log in

View Full Version : Need help on a script "if you know" !


MrNick
2004-12-03, 10:55 AM
it's a jup menu, I need it to open the link in a new page,
It juste whont work

can somone help me?

<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('form1.menu1.value,'_blank')">
<option>bla bla your bla bla</option>
<option value="videos.html">bla bla #1</option>
<option value="videos2.html">bla bla #2</option>
<option value="videos3.html">bla bla #3</option>
</select>
<input type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo('menu1','parent',1)">
</form>

thanks

AcidMaX
2004-12-03, 12:05 PM
You need to post the javascript code between the <head></head> tags so that we can show the code. It should be the MM_jumpMenuGo function at the top of the page.

MrNick
2004-12-03, 12:07 PM
oups sorry I forgot |rasta|

<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;
}

function MM_findObj(n, d) { //v4.01
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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
</script>

AcidMaX
2004-12-03, 12:16 PM
Well if you look at the function MM_jumpMenu. It has

targ,selObj,restore

So try

<select name="menu1" onChange="MM_jumpMenu('_blank','form1.menu1.value,'_blank')">

See if that works.

Andy

MrNick
2004-12-03, 12:36 PM
nop
open in the same window

I try everyting, and it just wont work |pissed|

dgraf
2004-12-04, 11:37 PM
Try rip all the JS code out and add the target element like this --


<form name="form1" target="_blank">