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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFrames - body onload of main page throws exception some times

Status
Not open for further replies.

venur

MIS
Aug 26, 2003
418
US
Hi,

I have a template page which has 2 Ifames inside it. onload of the template page I call a javascript function init(); the init() function will invoke another javascript function after 10 seconds which uses IFrame1 values to populate preview in Iframe2.

So my question is, when I invoke template page it throws javascript excetion only some times not always. What is the better way to handel this kind of excepions?

Exception I get is: A Runtime exception has occured
Do you wish to debug?
Line :1
Error: Syntax error.

Here is my init() function which is called from template body onload;

Code:
 function init(){
   try{
     initLoding();
     window.setTimeout('initPreview()', 10000);
   }catch (err){
     // some time this throws the error dont know the reason
   }
}

function initLoding(){
 contentViewer.innerHTML = "<b styleClass='OraHeader' style='font-size:13px'>Loading Preview with values....</b>";
}

Is this exception causing bcoz of initLoding().. hmm I have to look at that may be.

Thanks
venu
 
[tt]
function init() {
initLoding();
}
function initLoding(){
if (contentViewer) { //whatever it is! not clear at all
contentViewer.innerHTML = "<b styleClass='OraHeader' style='font-size:13px'>Loading Preview with values....</b>";
window.setTimeout('initPreview()', 10000);

} else {
window.setTimeout("init()",200);
}
}
[/tt]
But then the init() has a doubtful independent purpose except for the inflation. Simply put them together?
[tt]
function init() {
if (contentViewer) { //whatever it is! not clear at all
contentViewer.innerHTML = "<b styleClass='OraHeader' style='font-size:13px'>Loading Preview with values....</b>";
window.setTimeout('initPreview()', 10000);
} else {
window.setTimeout("init()",200);
}
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top