short code, window.status doesn't work??

Discussion in 'JavaScript' started by aayybb, Oct 30, 2008.

  1. #1
    Hi,

    I have the following short code and the window.status line doesn't work for me. It doesn't seem to be == "Done". The window.open and window.location work and it shows a image for me. Can anybody tell me what I did wrong on the window.status?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>search animation</title>
    <script type="text/javascript">


    function open_win()
    {
    myWindow=window.open('','MyName','width=120,height=100');

    myWindow.window.location="http://abc???.com//???/search_animate.html";

    myWindow.focus();
    var dd ="Done";
    if (myWindow.opener.window.status == dd)
    myWindow.opener.document.write("done")
    else
    myWindow.opener.document.write("This is the parent window")
    }
    </script>
    </head>

    <body>
    <form>
    <input type="button" value="Start count!" onClick="open_win()">

    </form>
    </body>
    </html>
     
    aayybb, Oct 30, 2008 IP
  2. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #2
    profs77, Oct 30, 2008 IP
  3. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much.
    In that case, then I can't use this function since not everybody turns that status on. Too bad. I was hoping to use it.
    Thanks again.
     
    aayybb, Oct 30, 2008 IP
  4. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I did try my program with status turn on following the instructions from the link. But it still doesn't work. I wonder why.
     
    aayybb, Oct 30, 2008 IP
  5. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #5
    If you write to window.status then you should be able to read back the value.
    The text that the browser writes to the status bar is not stored in window.status.
    For your purposes this is academic since the document in the popup will not have loaded at the point that you try to read the status bar.
     
    Logic Ali, Nov 1, 2008 IP
  6. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thank you very much for the explanation.
    My next question then. How do I stop thing running in the popup based on what happened in the parent window? Say I have something running in the parent window. I have an animated gif running in the popup. When the thing is done in the parent window I want the popup closed.

    How do accomplish this?
     
    aayybb, Nov 1, 2008 IP
  7. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #7
    myWindow.close();
    Code (markup):
     
    Logic Ali, Nov 2, 2008 IP
  8. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I am sorry. I didn't explain my question well.

    What I want to know is how to figure out the process is done in the parent window. I thought about checking status at first but that is not the right route.
     
    aayybb, Nov 2, 2008 IP
  9. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #9
    What is the process?
     
    Logic Ali, Nov 2, 2008 IP
  10. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I want to make the example simple here. Say the parent window is running a counting machine. It start counting from 1 till 1,000,000,000 then stops. Without checking the counter variable, is there any other way to know it is done counting?
    Or the parent window is searching something in the database. How can I tell it is done searching the database?
     
    aayybb, Nov 3, 2008 IP