js打开新窗口,js打开居中窗口,js打开自定义窗口

================================

©Copyright 蕃薯耀 2018年8月16日

http://fanshuyao.iteye.com/

var isIE=!!window.ActiveXObject;    //是否IE浏览器
var isIE6=isIE&&!window.XMLHttpRequest;  //是否IE6浏览器
var isIE7=isIE&&!isIE6&&!isIE8;  //是否IE7浏览器
var isIE8=isIE&&!!document.documentMode;  //是否IE8浏览器
var availheight = screen.availHeight;  //默认高度为屏幕的高度
if(isIE8){  availheight= screen.height;
}
//IE11升级弹出窗口小
if (!!window.ActiveXObject || "ActiveXObject" in window){availheight= screen.height;
}/**********************************************************************************
*函数名称: 打开新窗口
*功能说明: 通过传递参数打开一个定制的新窗口,
*参数说明:surl:        URL地址 windowName   弹出窗口的名字(不是文件名),非必须,可用空''代替; iheight      窗口高度; iwidth       窗口宽度; itop         窗口距离屏幕上方的象素值; ileft        窗口距离屏幕左侧的象素值; stoolbar     是否显示工具栏,yes为显示; smenubar     是否显示菜单栏,yes为显示;sscrollbars  是否显示滚动栏,yes为显示; sresizable   是否允许改变窗口大小,yes为允许; slocation    是否显示地址栏,yes为显示; sstatus      是否显示状态栏内的信息(通常是文件已经打开),yes为显示;
***********************************************************************************/    function openCustomWindow(surl,windowName,itop,ileft,iwidth,iheight,stoolbar,smenubar, sscrollbars,sresizable,slocation, sstatus)
{
window.open (surl, windowName, 'height='+iheight+', width='+iwidth+', top='+itop+', left='+ileft+', toolbar='+stoolbar+', menubar='+smenubar+', scrollbars='+sscrollbars+',resizable='+sresizable+',location='+slocation+', status='+sstatus)
}/*** 打开一个居中的窗口* @param pageUrl url链接* @param innerWidth 宽度,不带px,小于0表示百分比* @param innerHeight 高度,不带px,小于0表示百分比*/
function openWindowCenter(pageUrl, innerWidth, innerHeight){var screenWidth = screen.availWidth;var screenHeight = screen.availHeight;var width = screenWidth;var height = screenHeight;if(innerWidth < 1){width = screenWidth * innerWidth;screenWidth = (screen.availWidth - width)/2;}else{width = innerWidth;screenWidth = (screen.availWidth - innerWidth)/2;}if(innerHeight < 1){height = screenHeight * innerHeight;screenHeight = (screen.availHeight - height)/2;}else{height = innerHeight;screenHeight = (screen.availHeight - innerHeight)/2;}window.open(pageUrl, "", "left=" + screenWidth + ",top=" + screenHeight +",width=" + width + ",height=" + height + ",resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
};/*** 打开一个居中的窗口,可有滚动条* @param pageUrl url链接* @param innerWidth 长度,不带px* @param innerHeight 宽度,不带px*/
function openWindowScroll(pageUrl, innerWidth, innerHeight){var screenWidth = (screen.availWidth - innerWidth)/2;var screenHeight = (screen.availHeight - innerHeight)/2;window.open(pageUrl, "", "left=" + screenWidth + ",top=" + screenHeight +",width=" + innerWidth + ",height=" + innerHeight + ",resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
};/*** 打开一个居中的窗口,可变大小* @param pageUrl url链接* @param innerWidth 长度,不带px* @param innerHeight 宽度,不带px*/
function openWindowResizable(pageUrl, innerWidth, innerHeight){var screenWidth = (screen.availWidth - innerWidth)/2;var screenHeight = (screen.availHeight - innerHeight)/2;window.open(pageUrl, "", "left=" + screenWidth + ",top=" + screenHeight +",width=" + innerWidth + ",height=" + innerHeight + ",resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
};

================================

©Copyright 蕃薯耀 2018年8月16日

http://fanshuyao.iteye.com/

js打开新窗口,js打开居中窗口,js打开自定义窗口相关推荐

  1. oracle不能打开新任务,virtualbox 不能为虚拟电脑打开一个新任务?

    virtualbox版本 VirtualBox-4.3.24-98716-Win.1425444683.exe 我在重装系统之前,备份了虚拟机的SUSE系统 得到了 master.ova文件 重装系统 ...

  2. vue中按ctrl原页面锁定打开新页面

    可以通过vuex 或者 写个公共文件实现 vuex 实现思路 1.监听键盘按下事件 2.如果按下的按钮为ctrl, 就修改状态为true, 键盘抬起或者按键不对 状态都为false 3.需要监听所有的 ...

  3. java 打开新页签_java – GWT打开页面在一个新的选项卡

    我正在开发GWT应用程序,我使用 com.google.gwt.user.client.Window.open(pageUrl, "_blank", ""); ...

  4. Qt4_在Qt设计师中集成自定义窗口部件

    在Qt设计师中集成自定义窗口部件 在Qt设计师中使用自定义窗口部件之前,我们必须让Qt设计师先察觉到它们的存在.有两种方法可以完成这一任务:改进法(promotion)和插件法(pluigin). 改 ...

  5. JS打开新窗口的代码window.showModalDialog()

    用JS代码打开新窗口 function openNewWindow(url,width,height,formname) {     var feature="dialogWidth:&qu ...

  6. js打开新窗口并且不被拦截

    js打开新窗口并且不被拦截 window.open是javascript函数,该函数的作用是打开一个新窗口或这改变原来的窗口,如果你直接在js中调用window.open()函数去打开一个新窗口,浏览 ...

  7. js页面跳转 和 js打开新窗口 方法

    2010-07-10 23:56:45|  分类: js实用脚本|字号 订阅 第一种:     <script language="javascript" type=&quo ...

  8. js jquery新窗口打开的几种方式

    js jquery新窗口打开的几种方式 第一种:创建一个form表单,通过表单提交来实现新标签页打开. var form = document.createElement('form'); form. ...

  9. Js 跳转页面和打开新窗口的方法

    window.open('要跳转的网址'):打开新页面 打开新窗口,默认是_blank window.close():关闭使用JS创建的窗口,某些平台不能关闭 window.history.go(1) ...

最新文章

  1. AM3354开发 -- 使用root模式登录Ubuntu18.04
  2. 课程介绍 复习 创建对象的三种方式 自定义构造函数创建对象 工厂模式创建对象
  3. 手把手教你学Dapr - 1. .Net开发者的大时代
  4. SPOJ COT Count on a tree(主席树+倍增lca)
  5. 千元内无敌!红米两款新机发布 小米9侧目?
  6. HTML+CSS+JS实现计算机功能
  7. matlab:绘制box函数和高斯函数曲线并进行傅里叶变换
  8. matlab液压仿真实例,基于MATLAB-simulink的液压系统动态仿真.pptx
  9. eclipse导入静态网页模板+搭建springboot环境示例+细节问题解决(详细)
  10. 百度AI C#客户端车辆检测找不到VehicleDetect解决
  11. Huffman-哈夫曼编码算法详解
  12. java实现word文档形式导出(含多级表头)
  13. 牛逼!你竟然把VSCode玩成了IDEA的效果,有点哇塞。。。
  14. videoleap自带素材_videoleap教程:制作电影帷幕开场效果细解
  15. springboot返回date类型的数据会慢8个小时解决方案
  16. Speedoffice(PPT)如何设置文字顶部对齐
  17. Charindex、Patindex、Convert函数
  18. Android中的OpenGL使用初探
  19. 自定义控件 - 流式布局(CofferFlowLayout)
  20. unity3D实现录音功能,并将真实录音时长保存至本地(不能用可私信,附可执行文件下载地址)

热门文章

  1. visual studio2019+vcpkg管理第三方库(含使用Git管理工具下载vcpkg方法,已解决)
  2. win7激活提示错误代码0x80072EE2的最可行解决办法
  3. zblog php伪静态,zblog php版本后台伪静态的URL配置(建议方案)
  4. 用金蝶kis录入数量初始数据的方法
  5. excel中sumproduct()的用法
  6. 第一范式 第二范式 第三范式 BC范式
  7. Ubuntu下安装Matlab并破解
  8. lammps输出MSD(均方根位移)详解及示例教程
  9. 数据库中的九种数据库对象
  10. mbp连接wifi没弹出认证页面