34 users online (0 members and 34 guests)  


  Results 1 to 2 of 2

Related

  1. Popup-like window    Forum: HTML Forum
    Replies: 0
  2. Pop-up Window within PHP how?    Forum: PHP Forum
    Replies: 3
  3. Passing value from parent window to child window    Forum: Javascript Forum
    Replies: 0
  4. Replies: 1
  1. #1
    sjdk13's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    1

    Talking Popping up a window but not when it's already up.

    A popup window is automatically launched when you visit a certain page of my site. The window launches a music player that is put behind the main page (due to a focus(this); on the page). However, currently if you refresh the page, the popup is relaunched (to the same window) and the music is restarted -- which I don't want. I need a script that can pop up the window unless it the window is already open. Here's what I have so far:

    <script language="JavaScript">
    function popUp() {
    if (window.music.closed){
    window.open('music. htm','music','height=5,width=5,toolbar=no,status=n
    o,scrollbars=no,resize=no,menubar=no');
    }
    }
    </script>

    But this doesn't work. Any suggestions?

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi there,

    You were very nearly there with your code. Try this -

    Code:
    <script language="JavaScript">
    function popUp() {
    if (!window.win){
    win=window.open('music. htm','music','height=5,width=5,toolbar=no,status=no,scrollbars=no,resize=no,menubar=no');
    }
    }
    </script>
    Tested in IE6 and Mozilla Firebird. Seems to work. Hope it help.s
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread