<script language="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);
win.focus();
}
</script>
封装window.open.(始终居中打开)<br />
<a href="http://www.cnblogs.com/dudu837" onclick="NewWindow(this.href,'cname','500','500','yes');return false">点击</a>
<br />
<a href="http://www.cnblogs.com/dudu837" onclick="NewWindow(this.href,'cname','500','500','no');return false">http://www.cnblogs.com/dudu837</a>
<br />
<br/>