1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| <html>
<head>
<script type="text/javascript">
var centre = null;
var posX = null;
var posY = null;
var larg = 70;
var haut = 60;
larg = Math.ceil(screen.availWidth * (larg/100)*(1024/screen.width));
haut = Math.ceil(screen.height * (haut/100));
posX=Math.ceil((screen.availwidth - larg)/2);
posY=Math.ceil((screen.avalHeight - haut)/2)-50;
function ow(theURL,larg0,haut0) {
//----ça c'est le calcul de la position centrale de la fenetre---->
larg0 = Math.ceil(screen.availWidth * (larg0/100)*(1024/screen.width));
haut0 = Math.ceil(screen.availHeight * (haut0/100));
posX0=Math.ceil((screen.width - larg0)/2);
posY0=Math.ceil((screen.height - haut0)/2);
//------------------------- on ouvre centre ------------------------------->
centre = window.open(theURL,"inf2","scrollbars=yes,menubar=yes,location=yes,resizable=yes,width="+ larg0 +",height="+ haut0 +",top="+posY0+"px,left="+posX0+"px");
centre.focus();
}
</script>
<head>
<body>
<div><a href="#" onClick="ow('http://www.developpez.net/',60,50);">http://www.developpez.net/</a></div>
<script type="text/javascript">
document.write("<div style='position:absolute;width:"+larg+";height:"+haut+";top:"+posY+";left:"+posX+";border:1px solid black;padding:5px'>div 1</div>");
</script>
</body>
</html> |
Partager