zoukankan
html css js c++ java
javascript学习(三)——常用方法(2)
一、兼容性较高的浏览器页面关闭
//关闭网页,不支持火狐(火狐返回上次浏览页面) //FireFox非window.open()等弹出页面,需要在地址栏中输入about:config, 然后将dom.allow_script_to_close_windows改为true才能达到想要的效果。 function CloseWebPage() { if (navigator.userAgent.indexOf("MSIE") > 0) { if (navigator.userAgent.indexOf("MSIE 6.0") > 0) { window.opener = null; window.close(); } else { window.open('', '_top'); window.top.close(); } } else if (navigator.userAgent.indexOf("Firefox") > 0) { window.history.go(-1); } else { window.close(); } }
二、window.showModalDialog()扩展
<span style="font-size:13px;">// 打开ModalDialog子窗口,并获取返回值 function ModalDialogOpen(wUrl, wWidth, wHeight) { if (window.showModalDialog != null)//IE判断 { var returnvalue = window.showModalDialog(wUrl, "_self", "dialogWidth:" + wWidth + "px;dialogHeight:" + wHeight + "px;status:no;help:no;scrolling=yes;scrollbars=yes;center=yes"); if(!returnvalue){ returnvalue = window.ReturnValue;; } return returnvalue; } else { this.returnAction = function(strResult) { if (strResult != null) return strResult; } window.open(wUrl, "", "width=" + wWidth + ",height=" + wHeight + ",menubar=no,toolbar=no,location=no,scrollbars=yes,status=no,modal=yes"); } } // 关闭ModalDialog子窗口,并返回值 function ModalDialogClose(val) { if (window.showModalDialog != null)//IE判断 { if (navigator.userAgent.indexOf("Chrome") > 0) { // Chrome支持 window.opener.ReturnValue = val; } else { parent.window.returnValue = val; } window.close(); //firefox不支持 } else { window.opener.returnAction(val); top.close(); //IE和FireFox都支持 } } </span>
javascript学习(三)——常用方法(1)
查看全文
相关阅读:
Jenkins的插件管理(安装和更新插件)
[Flutter] MacOS/Windows Flutter 环境走一遍
[Sw] 使用 Swoole Server task/协程 处理大数据量异步任务时注意
[Sw] Swoole-4.2.9 可以尝试愉快应用 Swoole 协程
[PHP] 常备的现代 PHP 项目开发准备
[SF] Symfony 标准 HttpFoundationRequest 实现分析
[Linux] umask 从三类人群的权限中拿走权限数字
[Design] 后端程序的高并发与异步
[Linux]系统管理: 进程管理(ps/top/pstree/kill/pkill), 工作管理, 系统资源查看, 系统定时任务
[FE] 有效开展一个前端项目-V2 (vuejs-templates/webpack)
原文地址:https://www.cnblogs.com/bdstjk/p/2519867.html
最新文章
PHP 类中静态方法调用非静态方法
Nodejs 使用特定版本的SSL/TLS协议版本
TLS/SSL测试工具
pm2以windows服务运行
Nodejs编译Native Code:使用C++构建工具npm
Nodejs搭建wss服务器
nodejs图像处理模块
javascript的异步编程解决方案收集
Ajax如何设置cookie
正则表达式零宽度正预测先行断言?=
热门文章
XQuery使用sum求和,提示char不能转换为money解决方法
Jenkins的Windows Slave分布式构建和部署
js判断函数是否存在、判断是否为函数
sql分组(orderBy、GroupBy)获取每组前一(几)条数据
Html5+asp.net mvc 图片压缩上传
VisualSVN-Server 安装以及使用教程
16进制可逆加密算法
.net生成随机字符串
Jenkins+MSbuild+SVN实现dotnet持续集成 快速搭建持续集成环境
Jenkins的系统设置
Copyright © 2011-2022 走看看