In javascript how do I get a handle on the frame that I'm in based on an element in that frame?
function myFunction(elementInFrame){
// here I want to get a handle on the frame that elementInFrame lives in
}
In javascript how do I get a handle on the frame that I'm in based on an element in that frame?
function myFunction(elementInFrame){
// here I want to get a handle on the frame that elementInFrame lives in
}
In IE you can do elementInFrame.document.parentWindow
Doesn't work in Firefox unfortunately.
Edit: If you're using frames then in FF you could do it the long way... loop through all the frames until you find the element you're looking for.
elementInFrame.document.defaultView for non-IE browsers.
(It's not quite a standard part of the DOM; DOM Level 2 Views says the property exists but doesn't explicitly say it points to ‘window’, since the DOM standard currently known nothing about the window object.)