Skip to main content

Popup with adjustable size + centering on screen PLEASE HELP!

No replies
Joined: 2006-02-17


I really don't know very much about Java script until now, as I just use paragraphs of code 'copy&pasting' them to my site. My problem is the following.

On my startpage I have an 'if' loop implemented, that opens a popup window in a certain size, according to the screen resolution the computer uses.

However what I want is, that the window opens centered as well. How do I amend the code so that it works. At the moment the code looks like this:

function MM_openBrWindow(theURL,winName,features) { //v2.0
if (screen.width > 1000)"folio.htm", "_blank", " left=5,top=5,width=1003,height=639,toolbar=0,menub
else if (screen.width < 1020)"folio2.htm", "_blank", " width=780,height=500,toolbar=0,menubar=0,location=

function winOpen(url, breite, hoehe) { // Errechnet Koordinaten, um das Popup zentriert zu platzieren
links = (screen.width/2)-(breite/2);
oben = (screen.height/2)-(hoehe/2);,"popup","height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = no,fullscreen = no,top ="+oben+",left ="+links);

Please help me. I'm so lost...