//弹出一个对话框 参数的顺序: url, iWidth, iHeight, vArguments
function openDialog() {
var url, len = arguments.length, sFeatures, ret;
if (len == 1) {
url = arguments[0];
var iWidth = 800; //弹出窗口的宽度;
var iHeight = 600; //弹出窗口的高度;
return window.showModalDialog(url, "", "dialogWidth=" + iWidth + "px;dialogHeight=" + iHeight + "px;status=no;");
}
else {
url = arguments[0];
iWidth = arguments[1];
iHeight = arguments[2];
sFeatures = "dialogWidth=" + iWidth + "px;dialogHeight=" + iHeight + "px;status=no;";
if (len == 3) ret = window.showModalDialog(url, "", sFeatures);
else if (len == 4) ret = window.showModalDialog(url, arguments[3], sFeatures);
return ret;
}
}
//弹出一个新窗口 isres:是否可调整大小
function windowOpen(url, iWidth, iHeight, isres) {
var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
var rs;
if (isres == undefined) rs = 'no';
else rs = 'yes';
window.open(url, "_blank", 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft +
',toolbar=no,menubar=no,scrollbars=no,resizable=' + rs + ',location=no,status=no ');
}

用法

openDialog('/test/test3.aspx?r=' + Math.random(), 1200, 600, window);//打开对话框
windowOpen('/test/test3.aspx?r=' + Math.random(), 1200, 600);//打开新窗口
openDialog()这种方法已经不适用了,多数浏览器已经不支持,只有IE模式下支持

最新文章

  1. 灰色预测原理及JAVA实现
  2. python Requests库在处理response时的一些陷阱
  3. [JS5] 利用onload执行脚本
  4. IOS基础——IOS学习路线图(一)
  5. nls_sort和nlssort 排序功能介绍
  6. widows sever2003 PHP环境搭建
  7. Win8 X64下JDK版本切换问题
  8. 基于visual Studio2013解决面试题之0205查找路径
  9. ajax入门之建立XHR对象 (1)
  10. 视图和URL配置
  11. 第六章 对象-javaScript权威指南第六版
  12. Python函数式编程之lambda表达式
  13. Docker 微服务教程(搭建真正的网站)
  14. 剑指offer例题——旋转数组的最小数字
  15. box2d 计算下一帧的位置/角度
  16. 20155216 2017-2018-1 《信息安全系统设计基础》第二周课堂练习补交以及Myod的实现
  17. ZOJ 3774 二次剩余
  18. 数组中的k个最小值
  19. Core Data NSAttribute Type 数据类型
  20. 如何使用cPanel管理域名和数据库

热门文章

  1. php soap使用示例
  2. 解决Ubuntu(乌班图)vi/vim模式下粘贴的代码内容会多出的空格的问题
  3. BZOJ4829: [Hnoi2017]队长快跑
  4. win7下搭建nginx+php的开发环境(转)
  5. ubuntu安装opencv(自己编译)
  6. ruby 字符串
  7. Django 模型层--单表
  8. Django--组件-用户认证Auth(auth_user增加字段)
  9. listen 61
  10. find命令的基础用法以及按文件修改时间查找文件