在当前页面打开一个简易的浏览器window弹窗

114 阅读1分钟
function popWindow(url,width,height,resize="yes",scroll="yes"){       // 定义新窗口相关的变量       var newWindow = null;       var left = (screen.availWidth - width) / 2;  //width是弹窗宽度 left为左边距       var top = (screen.availHeight - height) / 2; //height是弹窗高度 top为上边距       var newWindowFeature = "resizable="+resize+", scrollbars="+scroll+", left=" + left + ", top=" + top + ", width="+width+", height="+height+",status=no";              // resize 是否可调整窗口大小   scroll是否显示滚动条    status=no去掉了页面header的一些附带信息       // 判断该窗口是否已经打开       if (newWindow == null || newWindow.closed) {              // 打开上述自定义特性的窗口              newWindow = window.open(url, "", newWindowFeature);  //第二个参数是窗口的名称,可以不给值       } else {              newWindow.focus();         }}