473,322 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Referring to one frame from another frame

4
I have a frameset with three frames:

[HTML]<html>
<head>
<title>Untitled</title>
</head>
<frameset rows="10%,*,10%" frameborder="1">
<frame src="button.htm" name="button" />
<frame src="main.htm" name="Main" id="Main" />
<frame src="menu2.htm" name="menu-one" />
</frameset>
</html>[/HTML]

My research says to refer from 1 frame to another like this:

[HTML]<INPUT TYPE="button" VALUE="Titles Only" onClick="top.frames[0].location='main.htm' ">[/HTML]

When I try this I get
top.frames0 is not an object

Any suggestions?
Apr 18 '08 #1
7 2147
pronerd
392 Expert 256MB
Ok. First of "top.frames[0].location='main.htm' " needs to be "top.frames[0].location.href='main.htm' "

Secondly it is usually easier to access elements across frames with relative rather than explicit paths. So something like this would work better.
Expand|Select|Wrap|Line Numbers
  1.  
  2. parent.frames[0].location.href='main.htm' 
  3. parent.button.location.href='main.htm' 
  4.  
Apr 19 '08 #2
sform
4
Thanks for your reply - still working on this:

Frameset page:

[HTML]<html>
<head>
<title>Untitled</title>
</head>
<frameset rows="10%,*,10%" frameborder="1">
<frame src="buttons.htm" name="buttons"/>
<frame src="display.htm" name="display"/>
<frame src="links.htm" name="links"/>
</frameset>
</html>
[/HTML]
Buttons.htm:

[HTML]<html>
<head>
<title>Buttons</title>
<script type="text/javascript">

function openframes() {

var a = top.location.href="links.htm";
}
</script>

</head>
<body>
<table>
<tr><td>

<input type=button value="Helper" onClick="openframes()"/>

</td>
</table>
</body>
</html>
[/HTML]
This puts links.htm into the full page, but what I want is for links.htm to appear in the "display" frame.
Should be able to do this by somehow referring to the frames array (frames[0[, frames[1]).
Apr 22 '08 #3
acoder
16,027 Expert Mod 8TB
Try:
Expand|Select|Wrap|Line Numbers
  1. top.display.location.href="links.htm";
PS. please use [code] tags when posting code. Thanks.
Apr 22 '08 #4
sform
4
Try:
Expand|Select|Wrap|Line Numbers
  1. top.display.location.href="links.htm";
PS. please use [code] tags when posting code. Thanks.
I get "top.display.location is null or not an object"
Apr 22 '08 #5
acoder
16,027 Expert Mod 8TB
Are you sure you have it like this:
Expand|Select|Wrap|Line Numbers
  1. function openframes() {
  2.     top.display.location.href="links.htm";
  3. }
Apr 22 '08 #6
sform
4
Are you sure you have it like this:
Expand|Select|Wrap|Line Numbers
  1. function openframes() {
  2.     top.display.location.href="links.htm";
  3. }

Just discovered that this happens only when previewing in the WYSIWYG HTML-Kit program but not when I preview in IE 6!

Thanks for your help!
Apr 22 '08 #7
acoder
16,027 Expert Mod 8TB
No problem, glad it's working. Post back to the forum if you have any more questions.
Apr 22 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was...
1
by: Konstantin Kudin | last post by:
All, I am trying to implement JavaScript that will remove a table row in frame , and append it to a table in frame . The browser is IE6. I've played with several approaches for quite a bit of...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
3
by: Microsoft | last post by:
How do I refer to the content of one frame from another frame. Depending on which command button is pressed in one frame I wish to chnage what is displayed in another frame. Thanks Colin
17
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page...
11
by: Rob | last post by:
I know, I know, don't use frames. Well, I'm stuck with these frames and I'm trying to add functionality without a complete redsign. You can look at this as a nostalgic journey. Anyway, I've got...
42
by: smerf | last post by:
Using javascript, is there a way to trap an external page inside a frame? I've seen scripts to break out of frames, but nothing to keep a page trapped in a frame.
6
by: Richard Maher | last post by:
Hi, Now that I am aware that JS on a page in Frame A can directly call a function on a page in Frame B, I no longer have to continue with my frameB.location.reload() fudge in order to get some...
1
by: sayid | last post by:
Hello, I have a problem when altering a DIV-element from another frame. The frameset looks like this: <frameset rows=0,0,* border=0> <frame name=header src=/header.htm scrolling=no...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.