Forum Moderators: open
Try this ...
<html>
<head><script type="text/javascript">
//<![CDATA[
function popup(url,windowname,width,height,features)
{
width=(width)?width:screen.width/2;
height=(height)?height:screen.height/2;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
var features= "width=" + width + ",height=" + height +",scrollbars=no,status=no";
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY + ",top=" + screenY;var mywin=window.open(url, windowname, features);
if (mywin)
mywin.focus();
return mywin;
}
//]]>
</script>
</head>
<body><a href="your_image.html" onclick="popup(this.href,'win1',200,200);return false" >Pop_Up</a>
</body>
</html>
style="margin:0"
birdbrain
Before we go any further, you say centre of the page, and by that I think that you mean the browser window. We can detect the users screen resolution and the available width and height of the browser window (don't forget, the browser could be in 'window' mode anywhere on the screen!). It can get very complicated to try and work out exactly where the centre is. My advice would be to open the new window in the centre of the screen, or just let things take their natual course!
Using window.open in a function, you could pass in the width and height of the image in the href as the window dimensions (don't forget to increase the height to allow for the title bar!).