HTML question.

phexus

New member
I'm doing a website, I've created thumbnails that you click on, which open up a new window displaying the full picture.. Is there a way to specify where on the screen the new window comes up? Right now they just come up in the top left of the screen, I would like them to be more centered on the screen. I think I learned how to do this in school, but I've forgotten.

THANKS!
 
I like to use this one that I tweaked here and there:

Javascript (put in the header)
Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function winPop(theURL, Name, popW, popH, left,up, scrollbar) { // V 1.0
var winleft;
var winUp;

if (winleft==null)
	 winleft = (screen.width - popW) / 2;
else
	winleft=left;
	
if (winUp==null)
	winUp = (screen.height - popH) / 2;
else
	winUp=up;
	
winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scrollbar+',resizable,menu=yes,toolbars=yes'

Win = window.open(theURL, Name, winProp)
if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}
//-->
</script>

and an href example
Code:
<a href="javascript:winPop('pop.php','popup',500,500,'','',1,'center')">popup</a>

paramaters should be fairly self explanatory
 
Back
Top