Centering Browser Pop-Up Window?

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

    Centering Browser Pop-Up Window?

    Hi- What do I need to add to this to make it pop up in the centre of the
    screen:

    <SCRIPT LANGUAGE="JavaS cript">
    function pop() {
    window.open("cu rrent.htm",""," height=200,widt h=200,left=0,to p=0");
    }
    </script>

    Thanks - Joe


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003


  • Lasse Reichstein Nielsen

    #2
    Re: Centering Browser Pop-Up Window?

    "Joe" <something_or_o ther@grapevine. net> writes:
    [color=blue]
    > Hi- What do I need to add to this to make it pop up in the centre of the
    > screen:[/color]

    Don't!
    <URL:http://www.infimum.dk/HTML/JSwindows.html# ref_3_3>

    If you insist, see below.
    [color=blue]
    > <SCRIPT LANGUAGE="JavaS cript">[/color]

    <script type="text/javascript">
    The type attribute is required in HTML 4
    [color=blue]
    > function pop() {[/color]

    var left = Math.floor((scr een.availWidth - 200) / 2);
    var top = Math.floor((scr een.availHeight - 200) / 2);
    window.open("cu rrent.htm",""," height=200,widt h=200,left="+le ft+",top="+top) ;
    [color=blue]
    > }[/color]

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Joe

      #3
      Re: Centering Browser Pop-Up Window?

      > > Hi- What do I need to add to this to make it pop up in the centre of the[color=blue][color=green]
      > > screen:[/color]
      >
      > Don't!
      > <URL:http://www.infimum.dk/HTML/JSwindows.html# ref_3_3>
      >
      > If you insist, see below.
      >[color=green]
      > > <SCRIPT LANGUAGE="JavaS cript">[/color]
      >
      > <script type="text/javascript">
      > The type attribute is required in HTML 4
      >[color=green]
      > > function pop() {[/color]
      >
      > var left = Math.floor((scr een.availWidth - 200) / 2);
      > var top = Math.floor((scr een.availHeight - 200) / 2);
      >[/color]
      window.open("cu rrent.htm",""," height=200,widt h=200,left="+le ft+",top="+top) ;[color=blue]
      >[color=green]
      > > }[/color]
      >
      > /L
      > --
      > Lasse Reichstein Nielsen - lrn@hotpop.com
      > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      > 'Faith without judgement merely degrades the spirit divine.'[/color]

      Thanks


      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (http://www.grisoft.com).
      Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003


      Comment

      • Joe

        #4
        Re: Centering Browser Pop-Up Window?

        Any idea how to add a scroll bar while I'm here?

        <script type="text/javascript">
        function pop() {
        var left = Math.floor((scr een.availWidth - 600) / 2);
        var top = Math.floor((scr een.availHeight - 300) / 2);
        window.open("cu rrent.htm",""," height=300,widt h=600,left="+le ft+",top="+top) ;
        }
        </script>

        Thanks - Joe


        ---
        Outgoing mail is certified Virus Free.
        Checked by AVG anti-virus system (http://www.grisoft.com).
        Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003


        Comment

        • Lasse Reichstein Nielsen

          #5
          Re: Centering Browser Pop-Up Window?

          "Joe" <something_or_o ther@grapevine. net> writes:
          [color=blue]
          > Any idea how to add a scroll bar while I'm here?[/color]

          window.open("cu rrent.htm",""," height=300,widt h=600,left="+le ft+
          ",top="+top+",s crollbars=yes,r esizable=yes");

          See: <URL:http://www.infimum.dk/HTML/JSwindows.html# ref_3_2>

          /L
          --
          Lasse Reichstein Nielsen - lrn@hotpop.com
          Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
          'Faith without judgement merely degrades the spirit divine.'

          Comment

          • HikksNotAtHome

            #6
            Re: Centering Browser Pop-Up Window?

            In article <1xuqow63.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
            writes:
            [color=blue]
            > var left = Math.floor((scr een.availWidth - 200) / 2);
            > var top = Math.floor((scr een.availHeight - 200) / 2);
            >
            >window.open("c urrent.htm","", "height=200,wid th=200,left="+l eft+",top="+top );[/color]

            And even that is not sure to work. My browser gives screen.availWid th as 2048,
            yet my displays don't allow window spanning, so it can only use 1024 on either
            monitor. Gives a nasty result when run as above :(
            --
            Randy

            Comment

            Working...