Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FrameSet.children has no propertie (Firefox doesn't work, but IE does) 1

Status
Not open for further replies.

Sniipe

Programmer
Oct 9, 2006
115
IE
hello all. I have an app that works in IE but I get this error in firefox
Code:
FrameSet.children has no properties

The code itself is pretty simple so I think I have just a syntax problem for firefox

Code:
function fnChangeHyperLinks(whatPage)
{
	//Find out what page in the main frame we are looking at: welcome, retrieve a quote, etc
	var FrameSet = window.parent.document.getElementById("frmSet");
	[b]var menuFrameObject = FrameSet.children[1].children[0];[/b]	
	var menuFrame = menuFrameObject;
	var menuWindow = menuFrame.contentWindow;		

	if (whatPage=="welcome")  //Show "Retrieve a quote" link, disable the other links
	{	
		var hdnCountrySelected = document.getElementById("hdnCountrySelected").value;
 
I don't think that children is standard syntax. Try this instead:
Code:
var menuFrameObject = FrameSet.[!]childNode[/!][1].[!]childNode[/!][0];

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Hey kaht, I got a little further but am stuck again :(

The setup is 3 frames in a frameset - header, menu and main
Code:
<FRAMESET rows="86px, *" border="0" id="frmSet" frameSpacing="0" frameBorder="0">

		<FRAME SRC="gblHeader.aspx" id="frmHeader" name="frmHeader"></frame>
		<frameset COLS='200px,*"'>
			<FRAME SRC="gblMenu.aspx" id="frmMenu" name="frmMenu"></frame>
			<FRAME id="frmBody" src="smbWelcome.aspx" name="frmBody"></FRAME>
		</frameset>
	</FRAMESET>

And this is part of the Javascript
Code:
function fnChangeHyperLinks(whatPage)
{
	//Find out what page in the main frame we are looking at: welcome, retrieve a quote, etc
	var FrameSet = window.parent.document.getElementById("frmSet");
	var children;
	if( typeof FrameSet.children == 'undefined' )
	{
		<!-- We are using mozilla -->
		children = FrameSet.childNodes;
		var menuFrameObject = FrameSet.childNodes[1].childNodes[0];
	}
	else
	{
		<!-- we are using IE -->
		children = FrameSet.children;
		var menuFrameObject = FrameSet.children[1].children[0];	
	}
	
	var menuFrame = menuFrameObject;
	var menuWindow = menuFrame.contentWindow;		

	if (whatPage=="welcome")  //Show "Retrieve a quote" link, disable the other links
	{	
		var hdnCountrySelected = document.getElementById("hdnCountrySelected").value;
		
		// Menu items should be disabled until the user has been created or until he selects country
		if (hdnCountrySelected == "1")
		{		
			//Display link "Retrieve A Quote"
			menuWindow.document.getElementById("hlRetrieveAQuote").style.display="block";
//....
menuWindow works for IE but not for mozilla firefox 2.0.
Any hints/help/pointers that get me moving in the right direction would be greatly appreciated.

Sniipe
 
First off, sorry for giving the wrong syntax in my post above - I left the s off the end of childNode[!]s[/!].

Secondly, firefox treats white space as a node, so by accessing childNodes[1], you might not be accessing what you think you're accessing. Make sure you're pointing to the right thing.

On a side note, in your code above you don't have to do the conditional check to see if .children is supported or not. childNodes works for Firefox and IE, so there's no sense in using .children at all.

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
I'm stuck again:

I'm very new to the whole compatibility, so if I have obvious mistakes, please point them out. Thanks. I'll start from scratch here and hopefully it will make more sense.
At the moment, I have a page with 3 frames (ref at the bottom)

The code I have that works in IE is as follows:
Code:
var FrameSet = window.parent.document.getElementById("frmSet");			
var children;
children = FrameSet.children;
var menuFrameObject = FrameSet.children[1].children[0];	
var menuFrame = menuFrameObject;
var menuWindow = menuFrame.contentWindow;
var mainFrameObject = FrameSet.children[1].children[1];	
var mainFrame = mainFrameObject;
var mainWindow = mainFrame.contentWindow;
and here is my attempt to get it working for Mozilla
Code:
var FrameSet = window.parent.document.getElementById("frmSet");			
var children;
children = FrameSet.childNodes;		
var menuFrameObject = FrameSet.childNodes[1].childNodes[0];
var menuFrame = menuFrameObject;
var menuWindow = menuFrame.contentWindow;
var mainFrameObject = FrameSet.childNodes[1].childNodes[1];	
var mainFrame = mainFrameObject;
var mainWindow = mainFrame.contentWindow;
The problem with my mozilla code is that it bombs out at the line: var menuWindow = menuFrame.contentWindow; stating in bugzilla that
menuFrame has no properties

I'd really appreciate any help you can give me, or even pointers. Thanks, Sniipe.






Frame code for ref
Code:
<FRAMESET rows="86px, *" border="0" id="frmSet" frameSpacing="0" frameBorder="0">
		<FRAME SRC="gblHeader.aspx" id="frmHeader" name="frmHeader"></frame>
		<frameset COLS='200px,*"'>			
			<FRAME SRC="gblMenu.aspx" id="frmMenu" name="frmMenu"></frame>
			<FRAME src="smbWelcome.aspx" id="frmBody" name="frmBody" runat="server"></frame>
		</frameset>
</FRAMESET>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top