How to display "please wait.." after new window opens

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Dalberg

    How to display "please wait.." after new window opens


    Hi

    I have a form that opens a new window for the results. Because the results
    might take a few seconds due to server processing, I would like to display
    a message "please wait" in the new window, erase that message when the
    processing is done and show the results.

    How is this done?

    John Dalberg
  • Kien

    #2
    Re: How to display "please wait.." after new window opens

    John Dalberg wrote:[color=blue]
    > Hi
    >
    > I have a form that opens a new window for the results. Because the results
    > might take a few seconds due to server processing, I would like to display
    > a message "please wait" in the new window, erase that message when the
    > processing is done and show the results.
    >
    > How is this done?
    >
    > John Dalberg[/color]

    Hi,
    Open a named window with a static page eg. wait.html (with the word
    "Please wait..." on it)
    The use windowName.docu ment.write(Resu lts) to replace the static page
    with results.

    Kien

    Comment

    • John Dalberg

      #3
      Re: How to display "please wait.." after new window opens

      On Wed, 04 Aug 2004 20:38:13 GMT, Kien wrote:
      [color=blue]
      > John Dalberg wrote:[color=green]
      >> Hi
      >>
      >> I have a form that opens a new window for the results. Because the results
      >> might take a few seconds due to server processing, I would like to display
      >> a message "please wait" in the new window, erase that message when the
      >> processing is done and show the results.
      >>
      >> How is this done?
      >>
      >> John Dalberg[/color]
      >
      > Hi,
      > Open a named window with a static page eg. wait.html (with the word
      > "Please wait..." on it)
      > The use windowName.docu ment.write(Resu lts) to replace the static page
      > with results.
      >
      > Kien[/color]

      It doesn't work for me. This is what I am doing. You can view the
      javascript, form and the button.

      <SCRIPT LANGUAGE="JavaS cript">
      <!--
      var msgWindow;
      var sResults;
      function newWin(){
      sResults = QueryResults;
      strFeatures='re sizeable=no,wid th=800,height=6 00';
      msgWindow=windo w.open('wait.ht m','',strFeatur es);
      msgWindow.docum ent.write(sResu lts)
      msgWindow.focus ();
      }

      This is the form:
      <form Method="get" name="frmDomain Check" action="whois.a sp"
      target="QueryRe sults">

      This is the button:
      <input type="submit" value="Check For Availability" class="whois"
      onclick="newWin ();return true">

      J.

      Comment

      • Grant Wagner

        #4
        Re: How to display &quot;please wait..&quot; after new window opens

        John Dalberg wrote:
        [color=blue]
        > Hi
        >
        > I have a form that opens a new window for the results. Because the results
        > might take a few seconds due to server processing, I would like to display
        > a message "please wait" in the new window, erase that message when the
        > processing is done and show the results.
        >
        > How is this done?
        >
        > John Dalberg[/color]

        -- on the page used to initate generation of the report:

        <input type="submit" value="Generate Report" onclick="openSt atusWindow();">
        <script type="text/javascript">
        function openStatusWindo w() {
        if (window.open) {
        var throwAway = window.open(
        'status.html',
        'statusWindow',
        'width=400,heig ht=200'
        );
        }
        }
        </script>

        -- status.html:

        <html>
        <head>
        <title>Generati ng report... please wait</title>
        <script type="text/javascript">
        function holdFocus() {
        var t = setTimeout(hold Focus, 1000);
        window.focus();
        holdFocus.toStr ing = function() {
        return 'holdFocus();';
        }
        }
        </script>
        </head>
        <body onload="holdFoc us();">
        <p align="center"> Generating report... please wait</p>
        </body>
        </html>

        -- on the page containing the resulting report:

        <body onload="closeSt atusWindow();">
        <script type="text/javascript">
        function closeStatusWind ow() {
        if (window.open) {
        var w = window.open(
        'about:blank',
        'statusWindow',
        'width=400,heig ht=200'
        );
        if (w && !w.closed) {
        w.close();
        }
        }
        }
        </script>

        It's necessary to call window.open() again on the window named "statusWind ow".
        If you do not, you will not have a reference (handle) to it, and will not be
        able to close it. I tested it in IE6SP1, Netscape 4.78, Firefox 0.9.2 and
        Opera 7.53 and it allowed me to open and close the window without holding a
        reference to it.

        --
        Grant Wagner <gwagner@agrico reunited.com>
        comp.lang.javas cript FAQ - http://jibbering.com/faq

        Comment

        Working...