PDA

View Full Version : location of popup


cornets
05-08-2003, 11:20 AM
Dear listmembers,

I generated the code for a popup window (not for an ad, but for a poem actually!) but I would like the window to pop up in the middle of the screen instead of in the top left corner. Can anybody tell me how to modify the code below to achieve this?
Many thanks!

Rutger H. Cornets de Groot

<script>

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="thankyou.htm"
winpops=window.open(popurl,"","width=400,height=338,resizable,")
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){
if (get_cookie('poppedup')==''){
openpopup()
document.cookie="poppedup=yes"
}
}

loadornot()
</script>

jalarie
05-08-2003, 02:34 PM
Within the window being popped up,

var W=width_of_your_popup_window;
var H=height_of_your_popup_window;
var W2=screen.width;
var H2=screen.height;
var PW=(W2-W)/2;
var PH=(H2-H)/2;
window.moveTo(PW,PH);

Len Whistler
05-08-2003, 11:27 PM
cornets....A little off topic, but I visited your site with a 17" monitor set at 800x600 and your navigation frame on the left is set to NO scroll and the links on the bottom are cut off.

I would recommend either setting it to AUTO or getting rid of the frames.

Leonard Whistler
www.stubby.ca

cornets
05-09-2003, 03:20 PM
Thanks for visiting and letting me know! I have no clue why I put NO scroll in there. I'm wondering though why you would have an 800x600 resolution on a 17" screen?
Thanks again,
Rutger

cornets
05-09-2003, 03:25 PM
Also thanks to Jalarie for the code. I'm not quite sure if I know how to implement this but I'll try and work on it...
Rutger
www.xs4all.nl/~cornets

Len Whistler
05-09-2003, 09:51 PM
QUOTE from cornets.......I'm wondering though why you would have an 800x600 resolution on a 17" screen?

I am on a public computer at the library and they are all set to 800x600, plus I also prefer this setting at home because everthing is bigger. I think this is a very common configuration, a 17 inch set to 800x600.

Leonard Whistler
www.stubby.ca