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>
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>