IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New My stuff's not in front of me...
...I vaguely recall having been down that road before. It's possible to get the enclosing window. What is regulated though, is the ability of one frame to call a function in another frame - some security issues get involved.

Anyhow, if you haven't found it by then, I'll try to look it up.
New We own all of the frames.
So security shouldn't be an issue.

If you can find your code that gets the enclosing window and let me know, I'd appreciate it. The method I'm using now (passing the window as a parm) works, but it's a bit inelegant.
Regards,

-scott anderson
New hmmm...
Found some really old stuff for Navigator 3, but it just set up a frame level property that was stored as the page was being created.

Don't know if this is what you are aiming at, but here's a stab:

main.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "[link|http://www.w3.org/TR/html4/frameset.dtd|http://www.w3.org/T...frameset.dtd]">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />
<title>Main</title>
<script language='JavaScript' type='text/javascript'>
function justForGrins(myparam) {
alert(myparam);
}
</script>
</head>
<frameset border="3" rows="50%,*">
<frame src="framea.html" name="bodya"
frameborder="1" marginheight="80" marginwidth="120" />
<frame src="frameb.html" name="bodyb"
frameborder="1" marginheight="80" marginwidth="120" />
</frameset>
</html>


framea.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />
<title>Frame A</title>
<script language='JavaScript' type='text/javascript'>
function tryThis(obj) {
obj.document.frames.parent.justForGrins("fred was here");
alert(obj.document.frames.parent.window);
}
</script>
</head>
<body>
Frame A Contents
<form name='myform' action='framea.html'>
<input name='fred' type='button' value='say' onclick='tryThis(this);' />
</form>
</body>
</html>


frameb.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />
<title>Frame B</title>
</head>
<body>
Frame B Contents
</body>
</html>


New No dice.
Apparently when you walk the DOM to get to an object, it's not the same object as the one referred to by "this".

I just get "node.document has no properties".
Regards,

-scott anderson
New Non standard
Not sure if there is a standard way to get there, but here's a non-standard technique that works with ie & ns differences built into the code. The dump routine just dumps all the properties and methods so I could try to track my way throw the collections (thought it might be useful).

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />
<title>Frame A</title>
<script language='JavaScript' type='text/javascript'>
function tryThis(node) {
if (node.document) {
node.document.frames.parent.justForGrins("Internet Exploder");
alert(node.document.frames.parent.window);
} else if (node.ownerDocument) {
node.ownerDocument.defaultView.parent.justForGrins("NetScrape");
alert(node.ownerDocument.defaultView.parent.window);
} else {
alert("SOL");
}
}

function dump(myObj) {
if (myObj == null) {
document.write("null<br>");
} else {
document.write("<table border=\\"3\\">");
document.write("<tr><th>Property</th><th>Value</th><th>Type</th></tr>");
for (var i in myObj) {
document.write("<tr>");
document.write("<td width=\\"200\\">" + i);
document.write("<td width=\\"200\\">");
if (myObj[i] != null) {
if (typeof(myObj[i]) == "string") {
document.write("\\"" + myObj[i] + "\\"");
} else {
document.write(myObj[i]);
}
} else {
document.write("null");
}
document.write("<td width=\\"100\\">" + typeof(myObj[i]));
}
document.write("</table>");
}
document.write("<br>");
}
</script>
</head>
<body>
Frame A Contents
<form name='myform' action='framea.html'>
<input name='fred' type='button' value='say' onclick='tryThis(this);' />
</form>
<script language='JavaScript' type='text/javascript'>
var node = document.getElementsByName("fred").item(0);
dump(node);

if (node.document) {
dump(node.document.frames.parent);
} else {
dump(node.ownerDocument.defaultView.parent);
}
</script>
</body>
</html>
New Yes, that seems to work.
But since I've already written by passing the Window object along during traversal, and this would be the first browser-specific code I'd have had to add, I think I'll stick with what I've got.

Thanks.
Regards,

-scott anderson
New Natch
Figured as much, but just wanted to complete the thought. :-)

Looks like the defaultView property may become a w3c standard sometime down the road. One thing that stuck out, though, is that I couldn't find the ownerDocument property in IE5.5 and that is part of the core DOM standard. And Opera JavaScript still seems to be lagging.

I gather y'all are standardizing on the latest builds of Mozilla. Out of curiosity, what IE version are they using? I still have some apps that have to go back to navigator 2.x and ie 3.x, though I'm not sure anybody is still out there using them.
New Still some problems with DOM in IE 5.5
NOt nearly as bad as the incompatibility problems of the past, but still annoying.

IE treats element attributes completely differently than Mozilla. Mozilla uses the W3C method of treating attributes as child nodes of the element; IE treats the attributes as a mapping on the element.
Regards,

-scott anderson
New "All your frame are belong to us"?
sorry...haven't had my fix in a few weeks. Needed a quick hit of AYBABTU
Jay O'Connor

"Going places unmapped
to do things unplanned
to people unsuspecting"
     Getting the owning window of an HTMLElement? - (admin) - (35)
         *sigh* - (Fearless Freep) - (21)
             You're a lot of help. ;-) - (admin) - (20)
                 thanks! - (Fearless Freep) - (19)
                     Re: thanks! - (admin) - (18)
                         Re: thanks! - (Fearless Freep) - (5)
                             Last impression - (admin) - (4)
                                 Ahh....forgot that - (Fearless Freep) - (3)
                                     Have you considered telling people? - (admin) - (2)
                                         Are you kidding? - (Fearless Freep) - (1)
                                             Well... - (admin)
                         Excuse me? - (ben_tilly) - (11)
                             Well, they're wrong. - (admin) - (10)
                                 Everything has its place - (ben_tilly) - (9)
                                     Your horse is getting taller by the minute. - (tseliot) - (8)
                                         What is a scripting language? - (ben_tilly) - (7)
                                             Good and bad scripting. - (static) - (2)
                                                 Unix scripting... - (ChrisR) - (1)
                                                     That is partly how it was designed - (ben_tilly)
                                             would scripting languages be anything with an interpreter? - (boxley) - (3)
                                                 Yup, IMO. Oh, and you forgot one: Java. -NT - (CRConrad)
                                                 Not necessarily. - (static)
                                                 I wouldn't draw the line there - (ben_tilly)
         Try '.parent' - (drewk) - (12)
             Nope. - (admin) - (11)
                 Either call from the element itself or pass params - (tseliot) - (1)
                     I passed params. - (admin)
                 My stuff's not in front of me... - (ChrisR) - (8)
                     We own all of the frames. - (admin) - (7)
                         hmmm... - (ChrisR) - (5)
                             No dice. - (admin) - (4)
                                 Non standard - (ChrisR) - (3)
                                     Yes, that seems to work. - (admin) - (2)
                                         Natch - (ChrisR) - (1)
                                             Still some problems with DOM in IE 5.5 - (admin)
                         "All your frame are belong to us"? - (Fearless Freep)

Ashes to Ashton, dust to debris.
73 ms