Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Showing an Alert box while a frame is loading

    Hello, All,

    I am trying to do the following and was wondering if someone could help me (either point me in an easier direction, or tell me what I'm doing wrong...)

    I have a page with two frames "AlexTop" and "AlexMain"

    Alex Top contains a SELECT statement which essentially navigates the AlexMain frame to a new url.

    What I'd like to do is - WHILE the AlexMain frame is loading the new page, a message should pop-up. (I want to use this for errors encountered in the AlexTop frame.)

    The code I have right now which is cauing a BUNCH of problems is:

    Code:
    <script type="text/javascript">
    
    function ShowMessage(LeMessage) {
      var rSt = parent.AlexMain.document.readyState;
    		if (rSt == 'loading') {
    			if (LeMessage) {
    				alert(LeMessage);
    			}
    		}
    }
    
    function LoadMainAndMessage(MainURL, MyMessage) {
    		if (MainURL) {
    			parent.frames['AlexMain'].onreadystatechange=ShowMessage(MyMessage);
    			parent.frames['AlexMain'].location=MainURL;
    		} else {
    			if (MyMessage) {
    				alert(MyMessage);
    			}
    		}
    }
    </script>
    To call this, I'm doing a:

    Code:
    <body onLoad="LoadMainAndMessage('http://www.yahoo.com','Error Message Goes Here.');" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
    I can't get it to work!!!

    Every time it runs, the alert message pops up FIRST. Then the user must acknowledge the Alert before the AlexMain frame will load. (Ideally, they would happen together.)

    Furthermore, it appears that when the SELECT box gets changed, the system responds with an Access Is Denied error at the start of the var line in the ShowMessage command.

    One final note on the functions:

    Because the existence of the URL or Message may be in doubt (sometimes, a selection won't have a URL, or it may not have a message,) that's where the whole condition statement comes from in there... Just in case you were wondering.

    Does anyone have any ideas as to how I can fix this?

    Thanks much!

    - Mike Z.

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    nothing you can do about the alert and frame loading problem. when you use an alert, it haults all browser processing of any page it is trying to load. only thing you may be able to do is create a layer that you can hide/show in one frame while the other frame is loading.
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •