Cant get targets to work in a pop-up menu.

liunx

Guest
Alright, Im using a 3 part frame set up to display a Download <!--more--> section. The top is the title with a Javascript menubar acrost the top (no problems with this). The left frame under the top frame is my menu. It has 5 pop-up menus each for a different catergory. Now, my problem is getting the options in the menus to open in the third frame on the right (named mainFrame).<br />
<br />
<form name="form1"><br />
<select name="creator" onChange="MM_jumpMenu('parent',this,0)"><br />
<option value="#Top" selected>Select One</option><br />
<option value="jassur.htm" target="mainFrame">Jassur</option><br />
<option value="xman.htm" target="mainFrame">Xman</option><br />
<option value="bball.htm" target="mainFrame>bball_1523</option><br />
</select><br />
</form><br />
<br />
Even with a target in there, the link opens into a new page. Anyone know how I can fix this?<!--content-->Target is not a valid attribute for the OPTION tag. You will need to modify the function that gets called (MM_jumpMenu) to set the location in the correct frame.<!--content-->function MM_jumpMenu(targ,selObj,restore){ //v3.0<br />
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");<br />
if (restore) selObj.selectedIndex=0;<br />
<br />
So I need to change this to what? (the frame i want it in is called mainFrame)<!--content-->Ok, having the code for the function clarifies it a little bit. So the first argument to that function is supposed to be the window you want to target, no changes needed to the function itself. Simply change the call to it on your onchange attribute to read:<br />
<br />
MM_jumpMenu('mainFrame',this,0)<br />
<br />
And you should be all set. The target was pointing to "parent" which means the links should have been opening in the main window, nuking your frameset in the process. Now they should go to the right place.<!--content-->function MM_jumpMenu('mainFrame',this,0){ //v3.0<br />
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");<br />
if (restore) selObj.selectedIndex=0;<br />
<br />
So it needs to be that?<br />
<br />
BTW, Thanx a lot bro!<!--content-->Oh, no no.. in your form the call to the function needs to be changed (my assumption was wrong in my first reply). So your form would start like...<br />
<br />
<form name="form1"> <br />
<select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)"> <br />
<br />
Nothing needs to be changed from the original function itself.<!--content-->Ah, I see. Sorry bout seeming like a moron. I DO know what Im doing most of the time. (but then again I normally spend time burried in pixels) {{GRAPHIX DESIGN}}<br />
<br />
Thanx a million!<!--content-->If you try to do this with JavaScript you will only find that it doesn't work for a good number of users. This method will always work:<br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<br />
"http://www.w3.org/TR/html4/loose.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>Drop Down With Frames</title><br />
<form name="form1" action="form1.pl" target="mainFrame"><br />
<div><br />
<select name="creator"><br />
<option value="#Top" selected>Select One</option><br />
<option value="jassur.htm">Jassur</option><br />
<option value="xman.htm">Xman</option><br />
<option value="bball.htm">bball_1523</option><br />
</select><br />
<input type="submit"><br />
</div><br />
</form><br />
<br />
<br />
And then get something like the following up and running and named something like "form1.pl":<br />
<br />
#!usr/local/bin/perl<br />
use CGI qw(redirect param);<br />
print redirect param 'creator';<!--content-->Okay, I understand EVERYTHING in the first part of your post, seeing as how it came from ...Dreamweaver?<br />
<br />
But the second part pretty much went WAY over my head.<br />
<br />
<form name="form1"><br />
<select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)"><br />
<option value="#Top" selected>Select One</option><br />
<option value="jassur.htm">Jassur</option><br />
<option value="xman.htm">Xman</option><br />
<option value="bball.htm">bball_1523</option><br />
</select><br />
</form><br />
<br />
My page dosent do anything now. Do I need to change something else?<!--content-->I think that we are all off the mark... I should have known..<br />
<br />
How bout this....<br />
<br />
<form name="form1"> <br />
<select name="creator" onChange="MM_jumpMenu('parent.frames[\'mainFrame\']',this,0)"><br />
<option value="#Top" selected>Select One</option> <br />
<option value="jassur.htm">Jassur</option> <br />
<option value="xman.htm">Xman</option> <br />
<option value="bball.htm">bball_1523</option> <br />
</select> <br />
</form><!--content-->It won't work on my browser.<!--content-->And you are using?<!--content-->Opera 6.05. But like 12% of users I'm not using JavaScript. I can't stand people resizing my windows.<!--content-->Haha, well, thanks for the help anyways!<!--content-->Originally posted by UltimateRCT <br />
Haha, well, thanks for the help anyways! <br />
<br />
Why do you deliberately want to break your pages for users without JavaScript when you don't need to?<br />
:confused:<!--content-->
 
Back
Top