[thelist] javascript RE-sizing open pop-up

Brett Stinson brettastinson at comcast.net
Fri Aug 8 22:23:53 CDT 2003


Ken:
  Here is the code for a small window I used to display "larger" pictures on
a website.
You should be able to modify this to do what you want...

___________________________begin code_____________________________________
<html>
<head>
<script language="Javascript">
var pWidth;
var pHeight;
function moveWin(){

window.moveTo((screen.width/2)-((pWidth)/2),(screen.height/2)-((pHeight)/2))
;
}
function resizeWindow(){
	pWidth=pic.width+50;
	pHeight=pic.height+100;
	if(pWidth > screen.width-50)
		pWidth=screen.width-50;
	if(pHeight > screen.height-50)
		pHeight=screen.height-50;
	window.resizeTo(pWidth,pHeight);
}
</script>
</head>
<body onload="resizeWindow();moveWin();">
<img name=pic id=pic src="<%="images/products/" &
Request.QueryString("Pic")%>"><br>
<form><INPUT type="button" value="Close" id=button1 name=button1
onclick="javascript:window.close();"></form>
</body>
</html>
___________________________end code_____________________________________

Hope it helps.

Brett Stinson
bstinson at programmer.net <mailto:bstinson at programmer.net>


-----Original Message-----
From: thelist-bounces-brettastinson=comcast.net at lists.evolt.org
[mailto:thelist-bounces-brettastinson=comcast.net at lists.evolt.org]On
Behalf Of Ken Wan
Sent: Friday, August 08, 2003 10:51 AM
To: thelist at lists.evolt.org
Subject: [thelist] javascript RE-sizing open pop-up


Okay, I have a question for you folks. This is my first post so please be
patient. I have a website where I use javascript pop-up windows to display
images in a gallery. The pop-up is set to not be resizable, no scrollbars
and no browser menu/buttons. However, there are two different sizes of
images...600x400 and 400x600 (landscape and portrait). When you click on a
portrait image and later click on a different portrait image, the new image
loads in the currently opened pop-up. Great! However, if you later click a
landscape image, a new pop-up is required because of the different
dimensions. Does anyone here know if it is possible to use javascript to
resize the pop-up that is already opened? If so, how would you go about
doing this?

Here's the code I use:
function openWindowPlain(url, name, width, height, scrollbars) {
    var x = (screen.availWidth - width) / 2;
    var y = (screen.availHeight - height) / 2;
}
----------------------
Ken Wan
--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !




More information about the thelist mailing list