Click to See Complete Forum and Search --> : positioning a window on the screen


simonbau
02-20-2003, 02:10 AM
hallo

i would like to place a new window in a particular place on the screen. what do i have to consider? in this special case i'd like the window to open in the middle of the screen?

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

window.open('man.html','maenner','width=800,left=screen.width/2,top=screen.height/2,screenX=screen.width/2,screenY=screen.width/2,height=600,scrollbars=no,resizable=no,status=no');

</SCRIPT>


thanks, simon

Charles
02-20-2003, 03:34 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Window Example</title>
<script type="text/javascript">
<!--
function newWin(url, height, width) {
if (navigator.appName == 'Opera') return true;
// the following will give unacceptable results in Opera running in "Multiple Document Interface" mode
var y = 0;
var x = Math.floor((screen.width - width) / 2);
var param = 'height=' + height;
param += ',width=' + width;
param += ',height=' + height;
param += ',screenX=' + x;
param += ',left=' + x;
param += ',screenY=' + y;
param += ',top=', + y;
window.open(url, 'child', param);
return false;
}
// -->
</script>
<p><a href="http://www.w3.org/" onclick="return newWin(this.href, 400, 300)">W3C</a></p>