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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple diffrent window size popup windows - Help

    Hello, I am looking for a script that allows multiple popup sized windows. The site will have several links to games and when they click on a link it needs to open a popup. But each game is various sizes so I need the ability to change popup window demensions.

    The script I am currently using is:
    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url)
    {
    newwindow=window.open(url,'name','height=550,width=600,top=50,left=200');
    if (window.focus) {newwindow.focus()}
    return false;
    }

    // -->
    </script>


    Link for popup code:
    <a href="/games/pool.php" onclick="return popitup('/games/pool.php')">3D Pool Deluxe</a>

    Thank you, the only problem with this script is I can not change the demensions of the popup for new windows the are all the same demensions

    Please Help
    Shawn

    PS - Also is there a script that auto creates the dimensions based on the demensions needed? Example the flash games was 500x600 so it would make a popup 600x700 (the extra 100 pixels would be to create a border around game. Just curious, thanks
    Last edited by antimedia; 10-19-2005 at 01:00 AM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    If all the links open in the same popup window:
    Code:
    function popitup(url, w, h)
    {
      var newW = w + 100; //add border
      var newH = h + 100; //add border
      var newwindow=window.open(url, 'name', 'height='+newH+', width='+newW+', top=50, left=200');
      newwindow.resizeTo(newW, newH); //if popup window is already open, the size specified in window.open does not take effect, so we need to resize it.
      newwindow.focus();
      return false;
    }
    ...
    <a href="/games/pool.php" onclick="return popitup(this.href, 500, 400)">3D Pool Deluxe</a>
    If all the links open in each own popup window:
    Code:
    function popitup(url, target, w, h)
    {
      var newW = w + 100; //add border
      var newH = h + 100; //add border
      var newwindow=window.open(url, target, 'height='+newH+', width='+newW+', top=50, left=200');
      newwindow.focus();
      return false;
    }
    ...
    <a href="/games/pool.php" target="_poolWin" onclick="return popitup(this.href, this.target, 500, 400)">3D Pool Deluxe</a>
    <a href="/games/game2.php" target="_game2Win" onclick="return popitup(this.href, this.target, 800, 600)">Game 2</a>
    <a href="/games/game3.php" target="_game3Win" onclick="return popitup(this.href, this.target, 400, 400)">Game 3</a>
    ...
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks glenngv

    I will try that as soon as I wake up, been at this so long looking at diffrent scripts I think im about to go into a coma.

    But I like the idea of one popup that can resize the popup on the fly based on the content in the popup

    Shawn


  •  

    Posting Permissions

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