SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru johnjohn2's Avatar
    Join Date
    Apr 2004
    Location
    here
    Posts
    746
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    popup link troubles

    does anyone know how to make the following code work by % instead of pixel. I need the windows to open but not completely maximized. Like say 30 pixels or 10 % small than maximized and centered as well. Is this possible?

    <a href="http://www.test.com/2.php" onclick="window.open('http://www.test.com/test.php','popup','width=600,height=700,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=50,top=50'); return false">test</a>

  2. #2
    SitePoint Enthusiast mrobinson's Avatar
    Join Date
    Aug 2004
    Location
    New York, NY, USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not perfect (I think different browsers treat the window sizes differently) but a starting point.

    This should give a 50px margin.
    HTML Code:
     <a href="#" onclick="window.open('test.htm','popup','width='+(screen.availWidth-100)+',height='+(screen.availHeight-100)+',scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=50,top=50'); return false">test</a>
    It's just a case of using some maths functions I guess to use percentages.

    Regards,
    Mark

  3. #3
    SitePoint Guru johnjohn2's Avatar
    Join Date
    Apr 2004
    Location
    here
    Posts
    746
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the help! works great now.


Bookmarks

Posting Permissions

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