Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Solution to find a frame by name in the frame hierarchy

Reply
Thread Tools

Solution to find a frame by name in the frame hierarchy

 
 
Daniel Frede
Guest
Posts: n/a
 
      01-27-2005
<script>try {
var frame1;
frame1=find('myFrameNameToFindInHierarchy',getFram e('myTopFrameName', window));
//debugger;
alert(frame1.name);
//Do something with the frame
frame1.document.location.reload;

}catch (e) {};


// Get frame by framename (recurse down)
function find(what,current) {
var ret;
for (var i=0;i<current.frames.length;i++) {
if (current.frames[i].name == what){
return current.frames[i];
}
ret = find(what,current.frames[i]);
}
return ret
}


// Get top frame by name (recurse up)
function getFrame(TopFrameName, currentWindow){
if (currentWindow.name == TopFrameName){
return currentWindow;
}
if (currentWindow.name == currentWindow.parent.name){
return getFrame(TopFrameName, currentWindow.opener);
} return getFrame(TopFrameName, currentWindow.parent);
}

</script>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Architecture name through hierarchy blaise.mulliez@gmail.com VHDL 6 04-03-2013 10:44 AM
How to find call hierarchy of a method Riyaz Java 5 08-07-2007 06:06 PM
Name conflict in class hierarchy Jeffrey Barish Python 8 05-23-2006 10:45 AM
frame hierarchy question... Mel Javascript 2 03-22-2005 07:03 AM
Proposed Image Hierarchy File Name Encoding Scheme Grant Robertson Digital Photography 1 05-13-2004 11:52 PM



Advertisments