473,382 Members | 1,376 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,382 software developers and data experts.

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.Frame2.Frame3.Frame4.Frame5 when the focus is on Frame5?

Hope someone knows the answer, thanks in advance

Le Cactus
Jul 20 '05 #1
3 5955
le*******@msn.com (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.Frame2.Frame3.Frame4.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(currentFrame) {
var path = "";
while (currentFrame != top) {
path = "."+currentFrame.name+path;
currentFrame = currentFrame.parent;
}
return "top"+path;
}

Then you can put this in each frame:

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

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.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.Frame2.Frame3.Frame4.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.Frame2.Frame3.Frame4.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.Frame5....
instead you would have smoething like Top.Frame1.Frame1.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.com (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.Frame2.Frame3.Frame4.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(currentFrame) {
var path = "";
while (currentFrame != top) {
path = "."+currentFrame.name+path;
currentFrame = currentFrame.parent;
}
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.currentFramePath = top.findPath(self);
}
</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
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....
3
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. ...
7
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. ...
4
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...
3
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...
11
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...
0
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...
1
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...
1
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.