Centering Pop Up Java Script Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spacedog
    Yes that IS me. Bitch.
    • Nov 2001
    • 14149

    #1

    Centering Pop Up Java Script Question

    Hi..
    Can some one help me with this code?

    The code works & functions fine, but I'd like the window to be in the center of the screen..What should I do?

    Here's the code..

    Code:
    function openpopup(){
    var popurl="eraser.htm"
    winpops=window.open(popurl,"","width=450,height=140,")
    }
    
    function get_cookie(Name) {
      var search = Name + "="
      var returnvalue = "";
      if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        if (offset != -1) { // if cookie exists
          offset += search.length
          // set index of beginning of value
          end = document.cookie.indexOf(";", offset);
          // set index of end of cookie value
          if (end == -1)
             end = document.cookie.length;
          returnvalue=unescape(document.cookie.substring(offset, end))
          }
       }
      return returnvalue;
    }
    
    function loadornot(){
    if (get_cookie('poppedup')==''){
    openpopup()
    document.cookie="poppedup=yes"
    }
    }
    
    loadornot()
    Thanks

    ------------------
    My Galleries suck, so please submit yours

    I'm Fucking Starving..Sign Up for My Sponsors..

    [This message has been edited by spacedog (edited 01-03-2002).]
  • Dopy
    Confirmed User
    • Feb 2001
    • 1572

    #2
    screenX=
    screenY=
    width=
    height=
    innerWidth=
    innerHeight=
    resizable=
    alwaysLowered=
    alwaysRaised=
    z-lock=
    dependent=
    directories=
    hotkeys=
    location=
    menubar=
    scrollbars=
    titlebar=
    toolbar=
    status=

    Comment

    • Squishy
      Confirmed User
      • Aug 2001
      • 1809

      #3
      Just stare at your monitor and hum a jaunty tune...it'll fix itsself.

      Comment

      • sw
        Registered User
        • Sep 2001
        • 16

        #4
        Just change the openpopup() function with this one:
        Code:
        function openpopup()
        {
        x=450
        y=140
        l=(screen.availWidth/2)-(x/2)
        t=(screen.availHeight/2)-(y/2)
        var popurl="eraser.htm"
        features="width="+x+",height="+y+",status=no,toolbar=no,menubar=no,resizable=no,left="+l+",top="+t
        winpops=window.open(popurl,"",features)
        }
        You can change to "status=yes", "toolbar=yes" etc

        Comment

        Working...