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)
查看全文
相关阅读:
windows本地文件搜索神器 Everything 为什么速度这么快?
Electron构建跨平台应用
「前端进阶」高性能渲染十万条数据(虚拟列表)
Chrome开发者工具之JavaScript内存分析
网页性能管理详解
TCP-IP详解:滑动窗口(Sliding Window)
滑动窗口
流量控制(滑动窗口)和 拥塞控制(拥塞控制的工作过程)
详解 Git 大文件存储(Git LFS)
TCP流量控制
原文地址:https://www.cnblogs.com/bdstjk/p/2519867.html
最新文章
char str[]和char *str的区别
AntD框架的upload组件上传图片时使用customRequest方法自定义上传行为
Promise入门详解和基本用法
老板的手机收到一个红包,为什么红包没居中?如何让一个元素水平垂直居中?
网页设计和开发中,关于字体的常识
第一次使用VS Code时你应该知道的一切配置
2020年Web前端最新导航(常见前端框架、前端大牛)
前端AntD框架的upload组件上传图片时遇到的一些坑
找工作面试会遇到哪些坑(社招篇)
找工作面试会遇到哪些坑(校招篇)
热门文章
移动Web前端,游客点击商品的收藏按钮,登录完成,回来之后,如何自动收藏
windowns解决hosts不起作用
windows下给 Git Bash 添加ssh key私钥实现git免密
mysql报错Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column问题
PHP中文件锁定 flock() 函数
ubuntu20.04 LTS 更换国内163源、阿里源、清华源、中科大源
ubuntu查看版本命令
ubuntu 20.04 LTS 安装后设置root密码
一定得选最好的黄金地段,雇法国设计师,建就得建最高档次的公寓
win10 修改默认浏览器
Copyright © 2011-2022 走看看