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 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Controlling Window Size

    The attached javascript below, slowly opens a new window when the link is clicked. I've managed to figure out how to control the "positioning" of where the window starts to "appear" & spread out...however, I need help figuring out how to control the size...say i want the window to open with only a width of 200 and height of just 200. And yeah, it wouldn't hurt either if the "speed" of "spreading" can also be managed...

    ---------------------------------------------------------------
    <body>

    <script>

    var mylocation="open_window.html"
    var winheight=100
    var winsize=100
    var x=5

    function go(){
    win2=window.open("","","scrollbars")
    if (!document.layers&&!document.all){
    win2.location=mylocation
    return
    }
    win2.resizeTo(100,100)
    win2.moveTo(100,150)
    go2()
    }
    function go2(){
    if (winheight>=screen.availHeight-3)
    x=0
    win2.resizeBy(5,x)
    winheight+=5
    winsize+=5
    if (winsize>=screen.width-5){
    win2.location=mylocation
    winheight=100
    winsize=100
    x=5
    return
    }
    setTimeout("go2()",50)
    }
    </script>
    <a href="javascript:go()"
    onMouseover="window.status='open window';return true" onMouseout="window.status=''">

    <p>Open window</a> </p>

    </body>
    Last edited by serendipity; 07-03-2003 at 04:54 AM.
    Thanks in advance for any replies! :)

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Change the size here

    win2.resizeTo(100,100)

    change the speed here

    setTimeout("go2()",50)

    A # < 50 would be faster

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by A1ien51
    Change the size here

    win2.resizeTo(100,100)

    change the speed here

    setTimeout("go2()",50)

    A # < 50 would be faster
    Thanks, but i don't think that did the trick for me...although im a bit puzzled coz it seemed fairly obvious that it might...

    the win2.moveTo <--adjusted the positioning, i thought there's a good chance the resize would be it...
    Thanks in advance for any replies! :)

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    this is another area

    winheight=100
    winsize=100

    if you are looking only for the max to be 200 then you would have to change the width property


  •  

    Posting Permissions

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