stewartwebb
Programmer
Hi All,
I have a problem with this page that is using a frameset. When the 2 frames load, onLoad in both frames calls a function which then displays a runtime error. The error doesn't appear everytime the page loads, it's very random, so i'm hoping someone can help.
In both the frames onLoad i'm calling a function called funcSetBannerInfo().
The reason i'm calling it from both frames is that the last frame that loads will perform the function, this is why i've got the frame check null at the beginning of the function.
This is when I get the runtime error:-
The function that is used in line 133 is as follows:-
This function setMainTitle() is called from funcSetBannerInfo().
Line 133 is the first line of code in the fuction(setMainTitle()).
As I said this is random and doesn't happen everytime.
Does anyone have any ideas why this is happening and how I can solve it?
Thanks
Stewart.
I have a problem with this page that is using a frameset. When the 2 frames load, onLoad in both frames calls a function which then displays a runtime error. The error doesn't appear everytime the page loads, it's very random, so i'm hoping someone can help.
In both the frames onLoad i'm calling a function called funcSetBannerInfo().
Code:
function funcSetBannerInfo()
{
if(window.top.window.frames[0] != null)
{
if(window.top.window.frames[1] != null)
{
setMainTitle();
checkDEMO();
window.top.window.frames[0].window.document.getElementById('Company').innerHTML = "";
window.top.window.frames[0].window.document.getElementById('Company').innerHTML = window.top.window.frames[1].window.document.form1.COYNAME.value;
}
}
}
The reason i'm calling it from both frames is that the last frame that loads will perform the function, this is why i've got the frame check null at the beginning of the function.
This is when I get the runtime error:-
Code:
line 133 window.top.window.frames.0.window.document.getElementById(.' is null or not an object
The function that is used in line 133 is as follows:-
Code:
function setMainTitle()
{
window.top.window.frames[0].window.document.getElementById('MainTitle').innerHTML = "";
for (i=0; i<window.top.window.frames[1].document.form1.elements.length; i++)
{
if (window.top.window.frames[1].window.document.form1.elements[i].name == "MAIN_TITLE")
{
window.top.window.frames[0].window.document.getElementById('MainTitle').innerHTML = window.top.window.frames[1].window.document.form1.elements[i].value;
break;
}
}
}
This function setMainTitle() is called from funcSetBannerInfo().
Line 133 is the first line of code in the fuction(setMainTitle()).
As I said this is random and doesn't happen everytime.
Does anyone have any ideas why this is happening and how I can solve it?
Thanks
Stewart.