PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Popup-Window



Jana
26-09-2003, 21:27
Ich hab in einem Forum ein Popup-Fenster von Mike entdeckt, daß sich der Bildschirmgröße anpaßt.

<html>
<head>
<title>Popup</title>

<script type='text/javascript'><!--

window.onload = function()
{w1 = new CWindow('w1', screen.width, screen.height,0,0, 0,1,1,1,0,0);}

function CWindow(name, w, h, x, y, loc, men, res, scr, sta, too)
{
var f = '';
if (w && h) {
if (document.layers) f = 'screenX=' + x + ',screenY=' + y;
else f = 'left=' + x + ',top=' + y;
f += ',width=' + w + ',height=' + h + ',';
}
f += ('location='+loc+',menubar='+men+',resizable='+res
+',scrollbars='+scr+',status='+sta+',toolbar='+too );
this.features = f;
this.name = name;
this.load = function(sUrl) {
if (this.wnd && !this.wnd.closed) this.wnd.location.href = sUrl;
else this.wnd = window.open(sUrl, this.name, this.features);
this.wnd.focus();
return false;
}
}

</script>

</head>
<body>
<a target='w1' href='pg.html' onclick="return w1.load('pg.html')">PopUp</a>

</body>
</html>

Die Funktionsparameter lauten:
name = window target
(Pass 0 to w and h for default size and position)
w = width
h = height
x = left coordinate
y = top coordinate
(Pass 0 or 1 to the following)
loc = location field
men = menubar
res = resizable
scr = scrollbars
sta = statusbar
too = toolbar