PDA

View Full Version : Eric King Center Popup IE7 problem



alesspunk
06-27-2007, 05:26 PM
1) Script Title: Auto center window script- Eric King

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/autocenter.htm

3) Describe problem: Is opening two windows. One in the target self of windows and the other is the center popup. (Problem only in IE7).

What can i do for only open the center popup window?


var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}



onclick="NewWindow(this.href,'name','936','620','no');return false"

thanks for any suggestions!

regards!

jscheuer1
06-28-2007, 06:26 AM
Nothing wrong with your code, works fine in IE 7 here:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<body>
<a href="http://www.google.com/" onclick="NewWindow(this.href,'name','936','620','no');return false">test</a>
</body>
</html>

Might be some setting(s) you have on your copy of IE 7. Under Vista, the default settings may be more restrictive. In other Windows OS's you can just reset to the defaults. This may also work in Vista.