Click to See Complete Forum and Search --> : Cant get targets to work in a pop-up menu.


UltimateRCT
12-11-2002, 01:44 AM
Alright, Im using a 3 part frame set up to display a download 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).

<form name="form1">
<select name="creator" onChange="MM_jumpMenu('parent',this,0)">
<option value="#Top" selected>Select One</option>
<option value="jassur.htm" target="mainFrame">Jassur</option>
<option value="xman.htm" target="mainFrame">Xman</option>
<option value="bball.htm" target="mainFrame>bball_1523</option>
</select>
</form>

Even with a target in there, the link opens into a new page. Anyone know how I can fix this?

Sceiron
12-11-2002, 01:55 AM
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.

UltimateRCT
12-11-2002, 02:12 AM
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;

So I need to change this to what? (the frame i want it in is called mainFrame)

Sceiron
12-11-2002, 02:21 AM
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:

MM_jumpMenu('mainFrame',this,0)

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.

UltimateRCT
12-11-2002, 02:24 AM
function MM_jumpMenu('mainFrame',this,0){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;

So it needs to be that?

BTW, Thanx a lot bro!

Sceiron
12-11-2002, 02:27 AM
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...

<form name="form1">
<select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)">

Nothing needs to be changed from the original function itself.

UltimateRCT
12-11-2002, 02:30 AM
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}}

Thanx a million!

Charles
12-11-2002, 02:33 AM
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:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Drop Down With Frames</title>
<form name="form1" action="form1.pl" target="mainFrame">
<div>
<select name="creator">
<option value="#Top" selected>Select One</option>
<option value="jassur.htm">Jassur</option>
<option value="xman.htm">Xman</option>
<option value="bball.htm">bball_1523</option>
</select>
<input type="submit">
</div>
</form>


And then get something like the following up and running and named something like "form1.pl":

#!usr/local/bin/perl
use CGI qw(redirect param);
print redirect param 'creator';

UltimateRCT
12-11-2002, 02:42 AM
Okay, I understand EVERYTHING in the first part of your post, seeing as how it came from ...Dreamweaver?

But the second part pretty much went WAY over my head.

<form name="form1">
<select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)">
<option value="#Top" selected>Select One</option>
<option value="jassur.htm">Jassur</option>
<option value="xman.htm">Xman</option>
<option value="bball.htm">bball_1523</option>
</select>
</form>

My page dosent do anything now. Do I need to change something else?

UltimateRCT
12-11-2002, 02:52 AM
I think that we are all off the mark... I should have known..

How bout this....

<form name="form1">
<select name="creator" onChange="MM_jumpMenu('parent.frames[\'mainFrame\']',this,0)">
<option value="#Top" selected>Select One</option>
<option value="jassur.htm">Jassur</option>
<option value="xman.htm">Xman</option>
<option value="bball.htm">bball_1523</option>
</select>
</form>

Charles
12-11-2002, 02:55 AM
It won't work on my browser.

UltimateRCT
12-11-2002, 02:55 AM
And you are using?

Charles
12-11-2002, 02:58 AM
Opera 6.05. But like 12% of users I'm not using JavaScript. I can't stand people resizing my windows.

UltimateRCT
12-11-2002, 03:00 AM
Haha, well, thanks for the help anyways!

Stefan
12-11-2002, 03:03 AM
Originally posted by UltimateRCT
Haha, well, thanks for the help anyways!

Why do you deliberately want to break your pages for users without JavaScript when you don't need to?
:confused: