Solved

Frameset

Posted on 2009-07-05
22
256 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:margarit
  • 12
  • 10
22 Comments
 
LVL 5

Expert Comment

by:Jagarm
ID: 24780777
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
 
LVL 5

Expert Comment

by:Jagarm
ID: 24780786
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
 

Author Comment

by:margarit
ID: 24812571
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
 
LVL 5

Expert Comment

by:Jagarm
ID: 24812649
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
 

Author Comment

by:margarit
ID: 24812706
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
 

Author Comment

by:margarit
ID: 24812718
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
 
LVL 5

Expert Comment

by:Jagarm
ID: 24812797
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
 
LVL 5

Expert Comment

by:Jagarm
ID: 24812868
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
 

Author Comment

by:margarit
ID: 24812882
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
 

Author Comment

by:margarit
ID: 24812891
I put it like this:
window.frames["main"].location.href = 'http://www.google.com';
 
0
 
LVL 5

Expert Comment

by:Jagarm
ID: 24812900
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 5

Expert Comment

by:Jagarm
ID: 24812909
Yes that way it will display on frame named "main" which is page3.html
0
 

Author Comment

by:margarit
ID: 24812952
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
 
LVL 5

Expert Comment

by:Jagarm
ID: 24813012
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
 

Author Comment

by:margarit
ID: 24813083
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
 

Author Comment

by:margarit
ID: 24813119
Hi,
I attach the screen shot

pic.JPG
0
 
LVL 5

Accepted Solution

by:
Jagarm earned 500 total points
ID: 24813128
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
 

Author Comment

by:margarit
ID: 24813245
WOW!!!! It works!!!! Thanks a lot!
last question:
maybe you know a good example ?
Thanks
0
 

Author Comment

by:margarit
ID: 24813247
I meant good site with examples
0
 
LVL 5

Expert Comment

by:Jagarm
ID: 24813272
Do you mean good site example of frames?

Here is one: http://w3schools.com/html/html_frames.asp
0
 

Author Comment

by:margarit
ID: 24813661
Yes! Thanks!
0
 

Author Closing Comment

by:margarit
ID: 31599924
THANKS!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now