473,545 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

complete path to top frame

Hi,

I have a tree like structure build with javascrtip and loads of
iframes. How can find the complete 'frame-path' to the frame that
focused? I'm sure I can contruct something with hidden input field so
I can do a loop till I'm at the top frame, but there might be a much
simpler way.

-------------------------------------------
| Top
| ----------------------------------------
| | Frame1
| | -------------------------------------
| | | Frame2
| | | ----------------------------------
| | | | Frame3
| | | | -------------------------------
| | | | | Frame4
| | | | | ----------------------------
| | | | | | Frame5
| | | | | |

In other ways, how do I know that I'm in
Top.Frame1.Fram e2.Frame3.Frame 4.Frame5 when the focus is on Frame5?

Hope someone knows the answer, thanks in advance

Le Cactus
Jul 20 '05 #1
3 5967
le*******@msn.c om (Cactus) writes:
I have a tree like structure build with javascrtip and loads of
iframes. How can find the complete 'frame-path' to the frame that
focused? I'm sure I can contruct something with hidden input field so
I can do a loop till I'm at the top frame, but there might be a much
simpler way.
I don't think so. The pages in the frames are independent of each
other, they don't need to know where they are in the frame structure.

I can't see what the hidden input fields should do.
In other ways, how do I know that I'm in
Top.Frame1.Fram e2.Frame3.Frame 4.Frame5 when the focus is on Frame5?


How do you know that the focus is in frame 5? That is the hard part.

You can probably do that with onfocus-handlers on the frame objects.

Assuming that you have a reference to the focused frame, currentFrame,
then you can use the parent property to find the surrounding frame:

function findPath(curren tFrame) {
var path = "";
while (currentFrame != top) {
path = "."+currentFram e.name+path;
currentFrame = currentFrame.pa rent;
}
return "top"+path;
}

Then you can put this in each frame:

<script type="text/javascript">
self.onfocus = function() {
top.currentFram ePath = top.findPath(se lf);
}
</script>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Cactus wrote:
Hi,

I have a tree like structure build with javascrtip and loads of
iframes. How can find the complete 'frame-path' to the frame that
focused? I'm sure I can contruct something with hidden input field so
I can do a loop till I'm at the top frame, but there might be a much
simpler way.

-------------------------------------------
Top
----------------------------------------
| Frame1
| -------------------------------------
| | Frame2
| | ----------------------------------
| | | Frame3
| | | -------------------------------
| | | | Frame4
| | | | ----------------------------
| | | | | Frame5
| | | | |


In other ways, how do I know that I'm in
Top.Frame1.Fram e2.Frame3.Frame 4.Frame5 when the focus is on Frame5?

Hope someone knows the answer, thanks in advance

Le Cactus


Maybe a different way to think of what you are trying to accomplish (I am
not exactly sure) would be to ensure the uniqueness of the frame names.
IE. Wouldnt you assume that Top.Frame1.Fram e2.Frame3.Frame 4.Frame5 will
definatly be Frame5 just because of the unique name of the frame?

I can not see why you would have something like Top.Frame1.Fram e5....
instead you would have smoething like Top.Frame1.Fram e1.5 or do smoething
like this....
Top.F1.F1_1.F1_ 1_1.F1_1_1_1
Top.F1.F1_2.F1_ 2_1.F1_2_1_1
Top.F1.F1_2.F1_ 2_2.F1_2_2_1
Top.F1.F1_2.F1_ 2_1.F1_2_2_2
This may or may not be any use to you. It was not use to me!
Jul 20 '05 #3
Lasse Reichstein Nielsen <lr*@hotpop.com > wrote in message news:<7k******* ***@hotpop.com> ...
le*******@msn.c om (Cactus) writes:
I have a tree like structure build with javascrtip and loads of
iframes. How can find the complete 'frame-path' to the frame that
focused? I'm sure I can contruct something with hidden input field so
I can do a loop till I'm at the top frame, but there might be a much
simpler way.
I don't think so. The pages in the frames are independent of each
other, they don't need to know where they are in the frame structure.

Bummer.
I can't see what the hidden input fields should do.
My idea was to put a hidden input field in earch frame. On frameload I
could fill the field with that field value of the parrent frame and
the current frame name. That way I would always know (in a frame)
where I am.
By calling a function in a frame witch returns me to the top frame, I
could then use that value (after transfering it to another hidden
field on the top frame) from where it was called.
In other ways, how do I know that I'm in
Top.Frame1.Fram e2.Frame3.Frame 4.Frame5 when the focus is on Frame5?


How do you know that the focus is in frame 5? That is the hard part.

You can probably do that with onfocus-handlers on the frame objects.

Assuming that you have a reference to the focused frame, currentFrame,
then you can use the parent property to find the surrounding frame:

function findPath(curren tFrame) {
var path = "";
while (currentFrame != top) {
path = "."+currentFram e.name+path;
currentFrame = currentFrame.pa rent;
}
return "top"+path;
}

Hmmm, thanks. That might also be a way to go about it. Thanks.

Then you can put this in each frame:

<script type="text/javascript">
self.onfocus = function() {
top.currentFram ePath = top.findPath(se lf);
}
</script>

/L


Thanks for the input.

Cheers,
Catci
Jul 20 '05 #4

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

Similar topics

12
15862
by: Anders Eriksson | last post by:
Hello! I'm trying to create a program that will watch a directory and when a file is created print that file. I have used FileSystemWatcher for watching the directory and I get an created event. The problem is that I don't know when the file is complete when using Explorer copy or move. I have tried to use FileIOPermission but I always...
3
1743
by: Rahul Agarwal | last post by:
Hi In our web page we use a combination of HTML and server side controls and some of them have a custom attribute based on which we need to find and replace the values once the HTML is ready. For e.g. <LABEL DICTCODE="XYZ">Some text</LABEL> At run time just before the complete HTML is sent to the client-side I want to get hold of the...
7
6368
by: TLM | last post by:
I am trying to build a web application that will contain links to files on a users local computer. I am assuming that the files will be in a known location and can display in a browser window. I have my ASP.NET application building links along the lines of file://c:/<path to file>
4
20828
by: Joe | last post by:
I created a CustomAction for this but I don't think I have it in the right place. I tried both Install and Commit but neither allow it to get to the final screen. Are there any examples of this anywhere? Thanks, Joe
3
7149
by: Vibhu | last post by:
Hello All, I have a input box on the HTML page with the type set to file. What I want is that when the value changes in the file textbox, it should give me the full file path. I have even tried passing the value to a hidden control but all it does is passes only the File Name and not the file path. How do I go about it. I tried checking...
11
26541
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my...
0
1095
by: SQACSharp | last post by:
Hi, I'm trying to get the complete path of all .exe returned by Process.GetProcesses() The problem is the "theprocess.MainModule.FileName"...sometime for some process it return stange invalid path like this : \??\c: \blablabla\myexe.exe Is there any other way to get the correct path (without the \??\)
1
2207
by: pavanip | last post by:
hi, I have an application that will find Firefox browing history, Auto complete datalist, Temp offline files and Find Computer list. please give me some idea on Auto complete datalist, Temp offline files and Find Computer list. I tried this task using path C:\documents and settings\eminosoft\Application...
1
2535
by: indu19 | last post by:
Hi, I am still fresher in php. so i need help... How to get upload file's complete path and how to store it in DB move_uploaded_file($_FILES,"c:/Indu/".$_FILES); I upload file using above code..
0
7490
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7935
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
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...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
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...
1
5351
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...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
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
0
734
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...

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.