...

View Full Version : Multiple diffrent window size popup windows - Help



antimedia
10-19-2005, 01:52 AM
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

glenngv
10-19-2005, 09:34 AM
If all the links open in the same popup window:

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:

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>
...

antimedia
10-19-2005, 02:18 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum