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 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Souteast Coast
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    open and close windows

    Hello,

    I'm trying to open a window that says please wait, when the user clicks on search. I have accomplished opening the window, and closing the window when the page unloads. But this happens to quickly and can't be read.

    What I want to happen is that the user click search, then the please wait box opens while the search contiunes to the next page. Once the page starts loading or finished loading i want that window to close the please wait box..

    Is there a way to do this??

    thanks
    hogtied

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    depending on how long the search takes, add this to your popup

    Code:
    <script type="text/javascript">
    setTimeout("self.close()",5000);
    </script>
    that would close the window in five seconds, or you could give the popup a name and when the search is complete add this to the page
    Code:
    <script type="text/javascript">
    windowname.close();
    </script>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Souteast Coast
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks chrismiceli, the timeout one would not be all that good considering the search has different complete times depending on how extensive the search is and internet connection.

    the second code although I will try that.

    Thanks

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Souteast Coast
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok ive tried the second code.

    this is what i have

    [in testopen.htm]
    user clicks search button

    OnSubmit="javascriptpenWait();" in the form tag

    function openWait() {
    window.open('wait.htm','waitBox');
    }

    [wait.htm.. just displays text and animated pic]
    the please wait window opens

    action="testclose.htm" in the form tag

    the testclose window opens (the search results)

    then what is suppose to happen is this

    [in testclose.htm]
    waitBox.close();

    but it doesn't close...??

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    [testclose.htm]
    <head>
    <script>
    var winpop = window.open('wait.htm','waitBox');
    window.onload = function(){
    if (winpop && !winpop.closed) winpop.close();
    }
    </script>
    </head>

    you can't open wait.htm in testopen.htm because the window handle for the popup will be destroyed once testclose.htm loads.

  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think that would defeat his porpuse, is there a way to destroy a popup made by another page?

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    i mean if you have this in testopen.htm:

    <script>
    var winpop = window.open('wait.htm','waitBox');
    window.onload = function(){
    if (winpop && !winpop.closed) winpop.close();
    }
    </script>

    and you submit the page to testclose.htm in the same window, the variable winpop will not be accessible to testclose.htm anymore since testopen.htm has unloaded.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Souteast Coast
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok What your saying does make sense. So the only way to go about this is to code the pop-up or make a layer visible on the testclose.htm [results page]. Then close or hide the layer once the page finishes loading.

    Now since browsers read from top to bottom. I would open the pop-up in the header or OnLoad. Then I would close the pop-up at the end of the html document.

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    open the popup in the <head> then close it onload


  •  

    Posting Permissions

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