This *.js file creates a centered popup based upon the dimensions (width, height) of the picture that is referred to.
A click on the picture will close the window (aswell).
// pop-up configuration
var _img = new Image;
// get/calculate required variables
var winl = (screen.width - _w) / 2;
var wint = (screen.height - _h) / 2;
// open window
var _win=window.open("","","height="+(_h)+", width="+_w+", top ="+wint+", left = "+winl+", resizable="+_resizable+", status="+_status+", scrollbars="+_scrollbars);
// write html content in new window
_win.document.write("<html>\n <head>\n <title>\n\t"+popup_title+"\n</title>\n</head>\n");
_win.document.write("<img src=\""+url_img+"\"\n\t alt=\""+img_alt+"\" onClick=\"window.close();\">\n");
(see the attached Zip file for an example)
The strange thing is that only the very first time the window is called / 'made' it is NOT centered, but at the bottom right corner and NOT in the specified dimensions. Every next time it works just great, even after deleting the cache. Beats me. My single guess is that perhaps a built in delay will do the trick properly / the first time aswell???
My problem is, if that's the solution, how / where to built in a time-delay? Any help / suggestions are appreciated.
Ps IE 5 and 6, XP and windows 95 tested. 2nd question: Is this an IE-thing only?