js变量设置 var iWidth = $(window).width() * 0.9; var iHeight = $(window).height() * 0.9; var iTop = (window.screen.height - 30 - iHeight) / 2; var iLeft = (window.screen.width - 10 - iWidth) / 2;
var tgUrl="https://www.baidu.com/";
js弹出窗体 //弹窗方式打开 var ifraDoc = $("<iframe id="viewDoc" src='" + tgUrl + "' style="height: " + iHeight + "px; padding: 10px; " + iWidth + "px; " marginheight="0" marginwidth="0" frameborder="0" height="0px" width="0px" ></iframe>"); $(ifraDoc).dialog({ autoOpen: true, modal: true, title: "文档预览" }); //新开页签方式打开 //window.open(tgUrl, "_blank", "status=no,toolbar=no,menubar=no,location=no,titlebar=no,scrollbars=no,resizable=yes,modal=true,alwaysRaised=yes,width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft+"");