473,811 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieve the location of a page in a frame

Fre
Hi, i made script with an alert window that should show me the location of
the page in frame CONTENT (..../artikels.aspx).
But it don't work, i got an error: 'top.frames.1.f rames' is empty or nog an
object.

When i try with: alert(top.locat ion)
i get the location of my index page, that works, but when i use the frame
arrays nothing works

Here is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<TITLE>My Title</TITLE>
<script>
alert(top.frame s[1].frames[1].frames[0].location);
</script>
</head>
<frameset cols="*,765,*" frameborder="no " border="0" framespacing="0 ">
<frame name="left" noresize src="bgframe.ht m">
<frameset rows="111,*" cols="*" frameborder="NO " border="0"
framespacing="0 ">
<frame name="head" src="header.htm " noresize scrolling="no">
<frameset cols="*,200" frameborder="NO " border="0" framespacing="0 ">
<frame name="content" src="artikels.a spx" scrolling="yes" >
<frame name="menu" src="menu.aspx" noresize scrolling="no">
</frameset>
</frameset>
<frame name="right" noresize src="bgframe.ht m">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</html>


Thx in advance!
Frederik
Jul 23 '05 #1
4 2001
On Sat, 17 Apr 2004 18:51:40 GMT, Fre
<fr************ *************** **@howest.be> wrote:
Hi, i made script with an alert window that should show me the location
of the page in frame CONTENT (..../artikels.aspx). But it don't work, i
got an error: 'top.frames.1.f rames' is empty or nog an object.

When i try with: alert(top.locat ion)
i get the location of my index page, that works, but when i use the
frame arrays nothing works

Here is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<TITLE>My Title</TITLE>
<script>
The type attribute is required. This should read

<script type="text/javascript">
alert(top.frame s[1].frames[1].frames[0].location);
</script>


At this point, the browser hasn't begun reading the frame and frameset
elements below, so the frames collection is empty. Either place the script
element below the closing frameset tag, or execute the script "onload".

[snipped frameset HTML]

You should really aim to avoid frames. CSS navigation menus are preferable.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
Fre
Now the code is error free, but i don't get an alertbox?

Thx for reaction Mike!

Frederik
Jul 23 '05 #3
On Sat, 17 Apr 2004 20:43:29 GMT, Fre
<fr************ *************** **@howest.be> wrote:
Now the code is error free, but i don't get an alertbox?


This is probably what you're after. The frames collection contains all of
the frames in a window, not per frameset. That means that "left" is frame
0, "head" is frame 1, "content" is frame 2, "menu" is frame 3, and "right"
is frame 4.

I took the liberty to make your sample validate (see
<URL:http://validator.w3.or g/>).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">

<title>My Title</title>

<script type="text/javascript">
function displayFrameSrc ( idx ) {
alert( frames[ idx ].location.href );
}
</script>
</head>

<frameset cols="*,765,*" onload="display FrameSrc(2)">
<frame name="left" noresize src="bgframe.ht m" frameborder="0" >
<frameset rows="111,*" cols="*">
<frame name="head" src="header.htm " noresize scrolling="no"
frameborder="0" >
<frameset cols="*,200">
<frame name="content" src="artikels.a spx" scrolling="yes"
frameborder="0" >
<frame name="menu" src="menu.aspx" noresize scrolling="no"
frameborder="0" >
</frameset>
</frameset>
<frame name="right" noresize src="bgframe.ht m" frameborder="0" >
<noframes>
<body>
<p>
This page uses frames, but your browser doesn't support them.
</p>
</body>
</noframes>
</frameset>
</html>

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #4
Fre
Thank you very much Mike to take time solving my problem!
Since you told me that the frames collection contains all of the frames in a
window i understand it perfect now.
I've read many forums before this post and there i've read some articles
with the use of this scriptline:
top.frames[1].frames[0].location (forum i visited for this script:
http://www.asp.net/Forums/ShowPost.a...&PostID=507978)

In the past i worked already with css for some of my school projects but for
this one i started working with frames (don't ask why :) but this is the
last time i do it this way)

Greetz Frederik

"Michael Winter" <M.******@bluey onder.co.invali d> schreef in bericht
news:op******** ******@news-text.blueyonder .co.uk...
On Sat, 17 Apr 2004 20:43:29 GMT, Fre
<fr************ *************** **@howest.be> wrote:
Now the code is error free, but i don't get an alertbox?
This is probably what you're after. The frames collection contains all of
the frames in a window, not per frameset. That means that "left" is frame
0, "head" is frame 1, "content" is frame 2, "menu" is frame 3, and "right"
is frame 4.

.... Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
14742
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to in VB. I've created an ASP interface where a user can select an email group that populates a listbox with those email addresses. If a user sees an email in that list that they do not want then they can remove it by clinking the Delete button...
1
1492
by: Funk | last post by:
Hi, I am currently creating a system that will support web based research. The idea is that the researcher is able to use Internet Explorer or Mozilla, or whichever browser to search for information and then be able to paste little tidbits of information to a seperate frame which will then be associated with the page they are viewing in the main page. So basically you have a 'main' frame which the researcher uses to google, and surf...
1
1271
by: Georgios Zakitraxis | last post by:
Hi, i have frames. I want to retrieve from a page in frame 1 the pagename of the page in frame 2 That should be possible with javascript, but I don't know how to. Suggestions, Hints, did anybody do that before?
10
16602
by: Roland | last post by:
Hello, the example code is the following(the number in parentheses at the beginning are just for reference)(The complete HTML file is at the end of this article): (1)window.location = 'http://www.google.com'; (2)alert("I'm still here!"); (3)window.open("http://www.slashdot.com", "_blank");
1
1425
by: Andrew Poulos | last post by:
I've got a simple navigation system set up in a framed site: navigation/top frame and a main body frame. Whenever you click on a navigation button it passes the new location to this function: gotoNewPage = function(loc) { main.location.replace(loc); // alert(loc); } which changes the page loaded in the main frame. This seems to work well
4
6318
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
2
3778
by: PopeLando | last post by:
I have a function that checks to see if we are in frames, and if we are, sets mainFrame location to the new url. What happens is, when you click the link that calls the function, (which is in a page in the left side-frame), this page loads in the main frame. Then when you click it again, the correct page (represented by gurl) loads in the page. Unfortunately I currently don't have IE6 or before to check if this happening. function...
4
6750
by: Matt | last post by:
I am no JavaScript guru so please bear with me and be as detailed as possible with your response. I thank you in advance. I have an ASP page that contains form elements. I also have an inline frame on this page that contains multiple checkboxes with the same name/id. This is a search form and users need the ability to select which categories they would like to search for. I have to put the categories in an inline frame to save real...
1
4533
by: michal.podlewski | last post by:
Hi All, I have a problem with a simple (as I thought till now) thing: I want to make a link in a child-window which would change site in the parent-window and along with closing child window. The parent window name is "main". A made a link like this in the child-site: <a href="new_address.html" target="main" class="about" onclick="javascript:main.location='new_address.html';self.close();"> change and close </a>
0
10652
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.