Frameset

Hello,

I never worked with frames before.
I have a main page with frameset and it contain 3 frames.
Each frame is a diffrent page.
On page1 I have a button. If I click this button I need to display page4 in another frame.
How can I do it. I need to present something in diffrent page.

THANKS
Margarit
<frameset rows="64,*">
	<frame name="banner" src="Page1.html" target="contents">
	<frameset cols="215,*">
		<frame name="contents" src="Page2.html" target="main">
		<frame name="main" src="Page3.html">
	</frameset>
	<noframes>
	<body>

Open in new window

margaritAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JagarmTechnical Support AnalystCommented:
You use the target properly of the link

so <a href="http://www.google.com" target="main">Google</a> this will display the page on main frame.

Let me know if it didn't work

Regards,
0
JagarmTechnical Support AnalystCommented:
Note that target use the name of the frame and not the id. Yours is fine, but just so you know and avoid confusions
0
margaritAuthor Commented:
Hello,
THANKS for the comment.
But on what page should I set this function/event.
On page1.html where my button is located or on MainPage.html?
THANKS
Margarit
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

JagarmTechnical Support AnalystCommented:
On the button, can you show me how you are using the button to display the link, I'll let you know how you should do it.

Regards,
0
margaritAuthor Commented:
Hello,
Thanks again. I attach you the whole page which includes the button: MainManu_but_Image
Thanks
Margarit


<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 3</title>
<base target="main" />
<script type="text/javascript"> 
 
function presetImageMenu()
{
	alert ("kuku");
	<a href="\Image\ImageSetMenu.html" target="main">myTest</a>
}
</script>
 
</head>
 
<body >
 
<form method="post">
<p>
<input name="MainManu_but_Image" style="width: 171px" type="button" value="Image" onclick="presetImageMenu()"/></p>
</form>
</body>
 
</html>

Open in new window

0
margaritAuthor Commented:
Hi,
The previous file with the button was MainMenu2.html.
The current file, is a main page with frameset.
Thanks

<html>
 
<head>
<script type="text/javascript"> 
</script>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled 1</title>
</head>
 
<frameset rows="64,*">
	<frame name="banner" noresize="noresize" scrolling="no" src="MainMenu1.html" target="contents">
	<frameset cols="215,*">
		<frame name="contents" src="MainMenu2.html" target="main">
		<frame name="main" >
	</frameset>
	<noframes>
	<body>
 
	<p>This page uses frames, but your browser doesn&#39;t support them.</p>
 
	</body>
	</noframes>
</frameset>
 
</html>

Open in new window

0
JagarmTechnical Support AnalystCommented:
The following is the javascript that you will use to display the link on the frame of your choice, simply replace frame_name with the name of your frame. So it's either contents or main.


<script type="text/javascript"> 
 
function presetImageMenu()
{
	window.frames["frame_name"].location.href = 'http://www.google.com';
}
</script>

Open in new window

0
JagarmTechnical Support AnalystCommented:
If you have the button just to display a link, then you don't need to have it inside a form tag, the following does exactly the same thing


<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 3</title>
<base target="main" />
</head>
 
<body >
 
 
<p>
<input name="MainManu_but_Image" style="width: 171px" type="button" value="Image" onclick="window.frames['new_frame'].location.href='http://www.google.com';"/>
</p>
 
 
</body
</html>

Open in new window

0
margaritAuthor Commented:
Hi,
Thanks!!!
Now it seems to enter the function it represet the alert on the screen.
But gives an error on :
window.frames["frame_name"].location.href = 'http://www.google.com';
The error says: "window.frames.main.location is null or not an object".
Does my frameset defined correctly?
THANKS a lot again!
0
margaritAuthor Commented:
I put it like this:
window.frames["main"].location.href = 'http://www.google.com';
 
0
JagarmTechnical Support AnalystCommented:
You have to change frame_name with the name of the frame of your own:

So...
window.frames["contents"].location.href = "http://www.google.com" will display google on Page2.html of your original script.

0
JagarmTechnical Support AnalystCommented:
Yes that way it will display on frame named "main" which is page3.html
0
margaritAuthor Commented:
Hello,
I get the same error :(
But I put attantion that I have a frameset inside a frameset. So maybe I have to call it in another way?
Thanks
 
0
JagarmTechnical Support AnalystCommented:
Which frame do you want to display the link?

Please note that your frame must have a name, since it uses the name and not id,
0
margaritAuthor Commented:
I want to click the button on frame "contents" and display "ImageSetMenu.html" page on frame "main".
Main frame set is build from 3 parts:
"banner", "main", "contents"
"contents" present MainMenu2.html page - and its code located their.
"banner" present MainMenu1.html page
I need to click on button located on MainMenu2.html (that located in "contents") and see "ImageSetMenu.html" page in "main" frame
0
margaritAuthor Commented:
Hi,
I attach the screen shot

pic.JPG
0
JagarmTechnical Support AnalystCommented:
Sorry about that, please use the following javascript, change window to top
<script type="text/javascript"> 
 
function presetImageMenu()
{
	top.frames['main'].location.href = 'http://www.google.com';
}
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
margaritAuthor Commented:
WOW!!!! It works!!!! Thanks a lot!
last question:
maybe you know a good example ?
Thanks
0
margaritAuthor Commented:
I meant good site with examples
0
JagarmTechnical Support AnalystCommented:
Do you mean good site example of frames?

Here is one: http://w3schools.com/html/html_frames.asp
0
margaritAuthor Commented:
Yes! Thanks!
0
margaritAuthor Commented:
THANKS!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.