日期:2014-05-16  浏览次数:20435 次

刚开始学javascript写的东西,window.open打开心窗口默认屏幕居中。

                   
                                                                刚开始学javascript写的东西,window.open打开心窗口默认屏幕居中,大家看了别笑弱智,给点鼓励!

function CenterWindow(url,w,h){
var x = window.screen.availHeight;
var y = window.screen.availWidth;
var CenterTop=(x-h)/2;
var CenterLeft=(y=w)/2;
window.open(url,"","width="+w+",height="+h+",top="+CenterTop+",left="+CenterLeft);
}

点我试试看