coredumped
10-10-2002, 11:22 PM
I'm quickly going nuts over this problem... so I hope someone here might be able to help me out, or at least explain why I'm having this problem.
My problem lies specifically with Mozilla (so far). My site is split into two frames, one is hidden (CONTROLFRAME) and one takes up the entire browser window (DISPFRAME). I have a collection of Javascript functions that I call from the CONTROLFRAME that are used to render HTML code into the DISPFRAME, specifically, layers.
Everything works fine (in Mozilla) until I get to a point where I need to retrieve some value from one of the layers that has just been created. I use getElementById() and the Javascript console responds with the error: "top.DISPFRAME.document.getElementById(menuLayer) has no properties."
I should point out that this error occurs within another function, and 'menuLayer' is an argument to the function where this fails. I have also tried to directly change the content of a layer and it still fails.
Below is a snippet of code where the problem is occurring. I won't post it all since there's way too much to go through.
NOTE: All the code posted below is called in the CONTROLFRAME, as described above.
code:--------------------------------------------------------------------------------
top.DISPFRAME.document.open();
top.DISPFRAME.document.write("<HTML><HEAD>\n");
top.DISPFRAME.document.write("<meta http-equiv=\"Expires\" content=\"-1\">\n");
top.DISPFRAME.document.write("<meta http-equiv=\"Pragma\" content=\"No-Cache\">\n");
top.DISPFRAME.document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"class01.css\" />\n");
top.DISPFRAME.document.write("<TITLE>Display Frame</TITLE>\n");
top.DISPFRAME.document.write("</HEAD>\n");
top.DISPFRAME.document.write("<BODY BGCOLOR=\"" + getBGColor() + "\" TEXT=\"#FFFFFF\" LINK=\"#FFFFFF\" VLINK=\"#FFFFFF\" ALINK=\"#0000FF\">\n");
createLayer("bgLayer",0,0,58,100,"LEFT","TOP",1,getBGColor());
createLayer("whiteBorderLayer",0,0,100,60,"CENTER","CENTER",2,"#FFFFFF");
createLayer("mainMenuLayer",0,0,17.6,57.48,"LEFT","CENTER",2,"#FFB500");
createLayer("contentBGLayer",18.14,0,81.9,57.48,"LEFT","CENTER",2,"#0000AA");
createLayer("contentBGImgLayer",0,0,56.0,57.48,"RIGHT","CENTER",2);
createLayer("sectionTitleLayer",39.2,24.8,56.4,7.7,"LEFT","TOP",3,null,"title");
createLayer("contentLayer",39.2,32.6,56.4,42,"LEFT","TOP",3,null,"content");
createLayer("siteTitleLayer",3.6,13.5,50,6,"LEFT","TOP",2,null,"siteTitle","./");
createLayer("loadingLayer",1,5,25,6,"LEFT","BOTTOM",4,null,"loading");
createMenu("mainMenu","mainMenuLayer",15.7,5.9,"RIGHT","CENTER","mainMenu");
createMenu("sectionMenu","contentBGLayer",15.7,5.9,"LEFT","CENTER","subMenu");
// Finish the HTML code for the page.
top.DISPFRAME.document.write("</BODY>\n");
top.DISPFRAME.document.write("</HTML>\n");
// Close the document for writing.
top.DISPFRAME.document.close();
top.DISPFRAME.document.getElementById('loadingLayer').innerHTML = "<b><i>Loading... Please Wait</i></b>";
getSection();
--------------------------------------------------------------------------------
The 'createLayer' functions above merely perform some calculations for placement of the layer, then use a good-ol' top.DISPFRAME.document.write() to create the layer. This works fine. However, the createMenu functions, which use one of the previous rendered layers to create a menu, is where the code fails. Right now, all I have in this function is:
code:--------------------------------------------------------------------------------
alert("Menu Layer '" + menuLayer + "' height: " + top.DISPFRAME.document.getElementById(menuLayer).style.height);
--------------------------------------------------------------------------------
This is where my problem lies. The getElementById call doesn't recognize the layer yet I assume. The Mozilla Javascript console, again, gives this error:
"top.DISPFRAME.document.getElementById(menuLayer) has no properties."
I've been fooling around with this for a few days and just can't find a solution for it. I've gone to so many different sites and looked in so many different books, but none of them say anything different. According to them, my code should work... but it doesn't.
Any help on this would be greatly appreciated so I don't have to go bald anytime soon. :^)
Thanx,
- coredumped.
My problem lies specifically with Mozilla (so far). My site is split into two frames, one is hidden (CONTROLFRAME) and one takes up the entire browser window (DISPFRAME). I have a collection of Javascript functions that I call from the CONTROLFRAME that are used to render HTML code into the DISPFRAME, specifically, layers.
Everything works fine (in Mozilla) until I get to a point where I need to retrieve some value from one of the layers that has just been created. I use getElementById() and the Javascript console responds with the error: "top.DISPFRAME.document.getElementById(menuLayer) has no properties."
I should point out that this error occurs within another function, and 'menuLayer' is an argument to the function where this fails. I have also tried to directly change the content of a layer and it still fails.
Below is a snippet of code where the problem is occurring. I won't post it all since there's way too much to go through.
NOTE: All the code posted below is called in the CONTROLFRAME, as described above.
code:--------------------------------------------------------------------------------
top.DISPFRAME.document.open();
top.DISPFRAME.document.write("<HTML><HEAD>\n");
top.DISPFRAME.document.write("<meta http-equiv=\"Expires\" content=\"-1\">\n");
top.DISPFRAME.document.write("<meta http-equiv=\"Pragma\" content=\"No-Cache\">\n");
top.DISPFRAME.document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"class01.css\" />\n");
top.DISPFRAME.document.write("<TITLE>Display Frame</TITLE>\n");
top.DISPFRAME.document.write("</HEAD>\n");
top.DISPFRAME.document.write("<BODY BGCOLOR=\"" + getBGColor() + "\" TEXT=\"#FFFFFF\" LINK=\"#FFFFFF\" VLINK=\"#FFFFFF\" ALINK=\"#0000FF\">\n");
createLayer("bgLayer",0,0,58,100,"LEFT","TOP",1,getBGColor());
createLayer("whiteBorderLayer",0,0,100,60,"CENTER","CENTER",2,"#FFFFFF");
createLayer("mainMenuLayer",0,0,17.6,57.48,"LEFT","CENTER",2,"#FFB500");
createLayer("contentBGLayer",18.14,0,81.9,57.48,"LEFT","CENTER",2,"#0000AA");
createLayer("contentBGImgLayer",0,0,56.0,57.48,"RIGHT","CENTER",2);
createLayer("sectionTitleLayer",39.2,24.8,56.4,7.7,"LEFT","TOP",3,null,"title");
createLayer("contentLayer",39.2,32.6,56.4,42,"LEFT","TOP",3,null,"content");
createLayer("siteTitleLayer",3.6,13.5,50,6,"LEFT","TOP",2,null,"siteTitle","./");
createLayer("loadingLayer",1,5,25,6,"LEFT","BOTTOM",4,null,"loading");
createMenu("mainMenu","mainMenuLayer",15.7,5.9,"RIGHT","CENTER","mainMenu");
createMenu("sectionMenu","contentBGLayer",15.7,5.9,"LEFT","CENTER","subMenu");
// Finish the HTML code for the page.
top.DISPFRAME.document.write("</BODY>\n");
top.DISPFRAME.document.write("</HTML>\n");
// Close the document for writing.
top.DISPFRAME.document.close();
top.DISPFRAME.document.getElementById('loadingLayer').innerHTML = "<b><i>Loading... Please Wait</i></b>";
getSection();
--------------------------------------------------------------------------------
The 'createLayer' functions above merely perform some calculations for placement of the layer, then use a good-ol' top.DISPFRAME.document.write() to create the layer. This works fine. However, the createMenu functions, which use one of the previous rendered layers to create a menu, is where the code fails. Right now, all I have in this function is:
code:--------------------------------------------------------------------------------
alert("Menu Layer '" + menuLayer + "' height: " + top.DISPFRAME.document.getElementById(menuLayer).style.height);
--------------------------------------------------------------------------------
This is where my problem lies. The getElementById call doesn't recognize the layer yet I assume. The Mozilla Javascript console, again, gives this error:
"top.DISPFRAME.document.getElementById(menuLayer) has no properties."
I've been fooling around with this for a few days and just can't find a solution for it. I've gone to so many different sites and looked in so many different books, but none of them say anything different. According to them, my code should work... but it doesn't.
Any help on this would be greatly appreciated so I don't have to go bald anytime soon. :^)
Thanx,
- coredumped.