var url="";//地址
var height = 500;
var width = 400;
var left = (screen.availWidth - width) / 2;
var top = (screen.availHeight - height) / 2;
if (top < 0) {
top = 0;
}
if (left < 0) {
left = 0;
}
var openWin = window.open(url, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=' + width
+ ',height=' + height + ',left=' + left + ',top=' + top);
window.onfocus = function() {//模仿模式窗口
openWin.focus();
}
网页自适应打开新窗口并模仿模式
本文介绍了一段JavaScript代码,用于在浏览器中创建一个自适应大小的新窗口,并在打开新窗口后将焦点转移到该窗口上,实现网页内容的自适应显示。
1590

被折叠的 条评论
为什么被折叠?



