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)
查看全文
相关阅读:
asp.net 获取当前项目的根目录路径
asp.net 中 UEditor 图片和附件上传失败的处理方法
[LOJ#2331]「清华集训 2017」某位歌姬的故事
[LOJ#2330]「清华集训 2017」榕树之心
[LOJ#2329]「清华集训 2017」我的生命已如风中残烛
[LOJ#2328]「清华集训 2017」避难所
[LOJ#2327]「清华集训 2017」福若格斯
[LOJ#2326]「清华集训 2017」简单数据结构
[LOJ#2325]「清华集训 2017」小Y和恐怖的奴隶主
[LOJ#2324]「清华集训 2017」小Y和二叉树
原文地址:https://www.cnblogs.com/bdstjk/p/2519867.html
最新文章
ubuntu系统没有声音解决方法
设计模式之职责链模式(JAVA实现)
VC++、MFC最好的开源项目
VS2017打包C#桌面应用
linux学习之硬盘的存储原理和内部架构
词向量之Word2vector原理浅析
VS2017中用C#调试DLL
LSH(Locality Sensitive Hashing)原理与实现
一文看懂25个神经网络模型
卷积的本质及物理意义(全面理解卷积)
热门文章
流形学习(manifold learning)综述
深度学习的57个术语
关于使用QQ、新浪微博、腾讯微博等第三方登录网站的开发过程(二)
关于使用QQ、新浪微博、腾讯微博等第三方登录网站的开发过程(一)
.net 的 Url 中文加密
关于 QRCode 的问题[C# 生成二维码固定大小]
关于web api 2 客户端请求Post
关于在VS 上发布网站
关于ASP.NET Web API 客户端的请求报文中添加 Authorization
扩展方法调用的问题
Copyright © 2011-2022 走看看