Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Target="MainFrame" ? 1

Status
Not open for further replies.

Chipsman

Programmer
May 26, 2005
44
GB
Hello,

I am using scroll down menus where the user must be able to select a link. Once the page selected, it should be displayed in my mainframe (I am using frames on the sides).

My problem is that in a form, it seems impossible to put
... target = "MainFrame" ...
So the page is displayed without my frames on the side.

Does anyone know how to make the page display in my Main Frame?

Thanks
 
I don't really know how to do this. I am a beginner with Webpages.

Here is the code I'm using:

====================================
<form name="form1" method="post" action="">
<p align="center">
<select name="Pick up" onChange="MM_jumpMenu 'parent',this,0)" >

<option value="#" selected>Related Links</option>
<option value=" Website</option>
<option value=" Intranet</option>
<option value=" Website</option>

</select>
</p></form>
==========================================

I would like to open the pages in the main frame. Using something like Target="MainFrame" but it doesn't work.

Can you show me how to modify that code please?
Thanks,

Chips
 
Eek. Dreamweaver.

Post the code for the Javascript function "MM_jumpMenu".
Actually, you may get better help in the Javascript forum.
I don't go there, I hate Javascript and avoid using it wherever possible, which is most places to be honest.

Can I ask why you are using a select box for navigation like this?

Bear in mind that anyone without javascript (including Search Engine Spiders and the terminally paranoid) will not be able to access the pages. This will be compounded by your use of frames, but I daren't go there.

As a possible alternative you could look at using a CSS drop down list which will be more accessible and easier for you to understand and manage once the CSS is set up.

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
Thanks Foamcow, but could you explained to me what a drop down list in a CSS is? I mean where do I find this? I suppose that it must be in DW but could you tel me wherer please?

The code of the MM_jumpMenu is:

=======================================
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}========================================
 
I don't know if it will work, but try this slight modification to your code using that Javascript function.


Code:
<form name="form1" method="post" action="">
<p align="center">
<select name="Pick up" onChange="MM_jumpMenu '[COLOR=red][b]MainFrame[/b][/color]',this,0)" >
                
<option value="#" selected>Related Links</option>
<option value="[URL unfurl="true"]http://www.lvmh.com">LVMH[/URL] Website</option>
<option value="[URL unfurl="true"]http://Vulcan">LVMH[/URL] Intranet</option>
<option value="[URL unfurl="true"]http://www.dior.com">Dior[/URL] Website</option>

</select>
</p>
</form>

I don't know if it will work (I am not a Javascript person really), but it's worth a try.


I don't have an exact example of a CSS dropdown used in the scenario you are using it. But take a look at the navigation on The drop down menus are simple HTML lists that are styled using CSS. It shouldn't be a great problem to change the CSS to suit your needs.
The benefit of this method is that for user agents that cannot use Javascript can still follow the links as they are in standard HTML lists. Clients without CSS simply see the list.

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
The problem may be with the frameset code.

For example if your frame looks like this:
<frame src="mainframe.htm" name="MainFrame" />

you must target with the same case.
eg. target="MainFrame" NOT target="mainframe"

If this is not the problem post your frameset code.

Clive
 
Errr, yes that's true.

But referring to the actual code posted

Code:
<select name="Pick up" onChange="MM_jumpMenu '[COLOR=red][b]parent[/b][/color]',this,0)" >

He is referencing 'parent' rather than 'MainFrame'

I thought that was more likely the cause of the problem.

Actually, looking at it again. There is a bracket missing from the javascript call.

Code:
<select name="Pick up" onChange="MM_jumpMenu '[COLOR=red][b]MainFrame[/b][/color]',this,0)" >

Should be

Code:
<select name="Pick up" onChange="MM_jumpMenu[COLOR=red][b]([/b][/color]'[COLOR=red][b]MainFrame[/b][/color]',this,0)" >

I think.

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
Thank you for trying to help me out :)

ok here is the code of the frameset:

==========================
<frameset cols="180,*,200" frameborder="NO" border="0" framespacing="0">
<frame src="Navigation Menu.htm" name="leftFrame"><!-- scrolling="NO" noresize -->
<frame src="Introduction.htm" name="mainFrame">
<frame src="News.htm" name="rightFrame">
</frameset>
==========================

and here the code of a form located on the mainframe. I tried the case changes but that doesn't work. When I actually change the "parent" into something else, the links just stop working... here is the code:

===============================
<form name="form1" method="post" action="">
<p align="center">
<select name="Pick up" onChange="MM_jumpMenu('parent',this,0)" >
<option value="#" selected>Related Links</option>
<option value=" Website</option>
<option value=" Intranet</option>
<option value=" Website</option>
</select></p>
</form>
===============================
 
Here you go.. you need to reference parent.mainFrame

This is the code for a test page I made using your code

Code:
<html>
<head>
<title>test frameset</title>

<script language="javascript">

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>
</head>

<body>
<form name="form1" method="post" action="">
<p align="center">
<select name="Pick up" onChange="MM_jumpMenu('[COLOR=red][b]parent.mainFrame[/b][/color]',this,0)" >
<option value="#" selected>Related Links</option>
<option value="[URL unfurl="true"]http://www.lvmh.com">LVMH[/URL] Website</option>
<option value="[URL unfurl="true"]http://Vulcan">LVMH[/URL] Intranet</option>
<option value="[URL unfurl="true"]http://www.dior.com">Dior[/URL] Website</option>
</select></p>
</form>
</body>
</html>

That seems to work fine.

Things to note:
[ul]
[li]The frame name in the script must match exactly[/em] the frame name in the frameset. (the parent.mainFrame part simply means "the frame called mainFrame that is part of the frameset that I am also part of")[/li]. So you must call your frame "mainFrame" for the above code to work.[/li]

[li]You have a space in the filename for your navigation file. Though this might work in some circumstances, it is far better to avoid spaces alltogether. I renamed it "navigationMenu.htm"[/li]
[/ul]

Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
This is Brilliant Foamcow!! It's working great! Thank you very much :)
 
Yes I see why. I made the same misstake several times when I was learning Java. It's kind of the same error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top