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

Page loading message w/ multiple frames

Status
Not open for further replies.

bslintx

Technical User
Apr 19, 2004
425
US
hi all...i am hoping someone can point me in the right direction on how to show a message while page is loading...

the problem i have is the page contains multiple frames

main page (frame structure) - checklist_frame.asp
Code:
<html>
<head>
<title></title>

</head>


<frameset framespacing="6" rows="40,*">
<frame src="title.html" FRAMEBORDER="no" BORDER="0" BORDERCOLOR="#3366cc"  scrolling="no" noresize>
<frameset cols="200,*" border="1" frameborder="1" FRAMESPACING="6" TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
<frame style="width:100%;" name="menu" src="category_frame.asp" FRAMEBORDER="no" BORDER="0" BORDERCOLOR="#3366cc" scrolling="auto">

	
<frame style="overflow-x:hidden;" name="report" rows=",*" src="checklist_form.asp" FRAMEBORDER="no" BORDER="0" BORDERCOLOR="#3366cc" scrolling="auto">

</frameset>

</body>
</html>

left menu (category) category_frame.asp
Code:
<html>
 <head>
  <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  <TITLE>Category Frame</TITLE>
   <script type="text/javascript" src="javascripts/preLoadingMessage.js"></script>
 </head>
 <frameset cols="100%" rows="25,0,25,0,25,0,25,0,25,*" frameborder="0" framespacing="0" ID="CategoryBar">
  <frame src="category_tab.asp?tab=my_profile" 		   name="tab_my_profile"        marginwidth="0" framespacing="0" marginheight="0" scrolling="no" frameborder="0">
  <frame src="category_menu.asp?category=my_profile" 	   name="menu_my_profile"       marginwidth="0" framespacing="0" marginheight="0" scrolling="auto" frameborder="0">
  <frame src="category_tab.asp?tab=my_discrepancy" 	   name="tab_my_discrepancy"    marginwidth="0" framespacing="0" marginheight="0" scrolling="no" frameborder="0">
  <frame src="category_menu.asp?category=my_discrepancy"   name="menu_my_discrepancy"   marginwidth="0" framespacing="0" marginheight="0" scrolling="auto" frameborder="0">
  <frame src="category_tab.asp?tab=unit_discrepancy" 	   name="tab_unit_discrepancy"  marginwidth="0" framespacing="0" marginheight="0" scrolling="no" frameborder="0">
  <frame src="category_menu.asp?category=unit_discrepancy" name="menu_unit_discrepancy" marginwidth="0" framespacing="0" marginheight="0" scrolling="auto" frameborder="0">
  <frame src="category_tab.asp?tab=unit_checklist" 	   name="tab_unit_checklist"    marginwidth="0" framespacing="0" marginheight="0" scrolling="no" frameborder="0">
  <frame src="category_menu.asp?category=unit_checklist"   name="menu_unit_checklist"   marginwidth="0" framespacing="0" marginheight="0" scrolling="auto" frameborder="0">
  <frame src="category_tab.asp?tab=my_checklist"   	   name="tab_my_checklist"      marginwidth="0" framespacing="0" marginheight="0" scrolling="no" frameborder="0">
  <frame src="category_menu.asp?category=my_checklist" 	   name="menu_my_checklist"     marginwidth="0" framespacing="0" marginheight="0" scrolling="auto" frameborder="0">
 </frameset>
</html>

what i can't figure out is where (which page and/or frame) i put the javascript code...i have put in the left (category) frame but the js halts loading...

here is the .js
Code:
document.write('<div id="loading"><br><br>Please wait...</div>');

// Created by: Simon Willison | [URL unfurl="true"]http://simon.incutio.com/[/URL]
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  document.getElementById("loading").style.display="none";
});

i need the loading message for the fact ...withing these frames i am building serverside scripts that create large recordsets for a javascript tree...this is my initial thought; however, if the loading message...for whatever reason cannot be done in this situation...i will go w/ plan b - ajax (onclick event to open each tree node hits server vs all-at-once)

so, w/ that in mind..
1. is it possible to do what i am asking?
2. how?, if possible
3. where does it go?

i am a total js newbie...i work serverside code and could use some help...it's greatly appreciated
 
thanks dian..but unfortunately, i am having the same bad luck...i put the onload event into the frameset tag...it works; however AFTER the page loads???!!!...same result as before...

i don't quite understand the behavior if i am requesting an onload event

...trying to illustrate what i am trying to do (generic)
Code:
<html>
 <head>
  <script>function showMessage
        {
         document.write('loading...');
         }
  </script>
 </head>

 <!-- onload writes message until finished loading frames-->
 <!-- within the frameset-->

 <frameset onload="showMessage();" cols="100%" rows="25,0,25,*">
  <frame src="category_tab.asp">
  <frame src="category_menu.asp">
 </frameset>
</html>


any more suggestions?

thanks
 
That's because the onLoad event is fired after the page is loaded.

If you want to execute something before the frames load, you can set your frames source to blank, use onload event of the frameset for whatever you want to do and the set the urls of the child frames.

Cheers,
Dian
 
ahhh...thanks for the clarification...i thought is was implied as ON as in now/during not after load..perhaps afterLoad is more appropriate ;-)...jk...anyways ...i'll experiment w/ the advice given...and post if i found a fix..thanks for your time
 
One solution would be to have the content of each frame wrapped in a DIV set hidden.

Have a javascript function to toggle the visibility or display property of the content divs in the frame pages but have it check a counter to see if all of the pages have loaded. For instance, if you have three frames that have to finish loading before showing any of them, have a counter on the function. Each time the function is called you increment the counter by 1 and if the counter is 3 you then toggle the content.
From each frame have an onload event to call the function and when the final frame has called the function it would then allow them to display.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top