Click to See Complete Forum and Search --> : Child frame's title from the parent frame?


Angry Black Man
05-30-2005, 01:12 PM
This has me absolutely pulling my hair out. I've searched google, and found absolutely nothing regarding why i receive errors when trying to get a child frame's title to be handled by the parent frame.

here is my frame page code:

<script language="javascript">
<!--
var unalteredURL = window.location + "";
var subUrlBegin = unalteredURL.indexOf("?") + 1;
var subUrlEnd = unalteredURL.lastIndexOf("");
var url = unalteredURL.substring(subUrlBegin, subUrlEnd);

document.write("<html>");
document.write("<head>");
document.write("<title>"+url+"</title>");
document.write("</head>");

document.write("<frameset frameborder='0' framespacing='0' border='0' rows='47,*'>");
document.write("<frame src='about:nothing' name='bannerframe' marginwidth='4' marginheight='0' scrolling='no' noresize='true' bordercolor='#FFFFFF'></frame>");
document.write("<frame src='"+url+"' name='contentframe' bordercolor='#FFFFFF'></frame>");
document.write("</frameset>");
document.write("</html>");
-->
</script>

basically, there is a link on another page that points to the file containing this, and that link also has a question mark at the end specifying the url target of the frame called "contentframe"

my problem is, whenever i try, from this file, to get the title of the returntoglobemaster frame, i either get undefined or "access is denied" as the script fails to run.

when i get undefined, its when i use the following:

window.frames['contentframe'].title

when i get access denied, its when i have .document anywhere after frames[i] is dfined.

for the love of God, please help!

NileshXYZ
05-31-2005, 01:09 AM
try something like this..

parent.contentframe.document.title = 'whatever title is'

var x = parent.contentframe.document.title;
--------

x = title of frame

more info at http://www.quirksmode.org/js/frameintro.html