Js 根据不同浏览器弹出窗口
/// <reference path="intellisense/jquery-1.2.6-vsdoc.js" />
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var ua_match = /(trident)(?:.*rv:([\w.]+))?/.exec(userAgent) || /(msie) ([\w.]+)/.exec(userAgent);
var is_ie = ua_match && (ua_match[1] == 'trident' || ua_match[1] == 'msie') ? true : false; function LoadDialogWindow(URL, parent, loc_x, loc_y, width, height) {
if (is_ie)//window.open(URL);
window.showModalDialog(URL, parent, "edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:" + width + "px;dialogHeight:" + height + "px;dialogTop:" + loc_y + "px;dialogLeft:" + loc_x + "px", true);
else
window.open(URL, parent, "height=" + height + ",width=" + width + ",status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=" + loc_y + ",left=" + loc_x + ",resizable=yes,modal=yes,dependent=yes,dialog=yes,minimizable=no", true);
}
function AddUser(inputid) { URL = "user.aspx?inputid=" + inputid;
loc_y = loc_x = 200;
height = 450;
if (is_ie) {
loc_x = document.body.scrollLeft + event.clientX - 100;
loc_y = document.body.scrollTop + event.clientY + 100;
height += 50;
}
LoadDialogWindow(URL, self, loc_x, loc_y, 550, height); //这里设置窗口的宽度和高度
}
//获取父窗口值
function getUserName(inputid) {
if (is_ie)
return window.dialogArguments.document.getElementsByName(inputid)[0].value;
else
return window.parent.opener.document.getElementById(inputid).value;
}
//设置父窗口值
function setUserName(inputid, users) {
if (is_ie)
window.dialogArguments.document.getElementsByName(inputid)[0].value = users;
else
window.parent.opener.document.getElementById(inputid).value = users;
} try { document.execCommand("BackgroundImageCache", false, true); } catch (e) { }
var popUpWin;
function PopUpCenterWindow(URLStr, width, height, newWin, scrollbars) {
var popUpWin = 0;
if (typeof (newWin) == "undefined") {
newWin = false;
}
if (typeof (scrollbars) == "undefined") {
scrollbars = 0;
}
if (typeof (width) == "undefined") {
width = 800;
}
if (typeof (height) == "undefined") {
height = 600;
}
var left = 0;
var top = 0;
if (screen.width >= width) {
left = Math.floor((screen.width - width) / 2);
}
if (screen.height >= height) {
top = Math.floor((screen.height - height) / 2);
}
if (newWin) {
open(URLStr, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
return;
} if (popUpWin) {
if (!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
popUpWin.focus();
} function OpenModelWindow(url, option) {
var fun;
try {
if (parent != null && parent.$ != null && parent.$.ShowIfrmDailog != undefined) {
fun = parent.$.ShowIfrmDailog
}
else {
fun = $.ShowIfrmDailog;
}
}
catch (e) {
fun = $.ShowIfrmDailog;
}
fun(url, option);
}
function CloseModelWindow(callback, dooptioncallback) {
parent.$.closeIfrm(callback, dooptioncallback);
}
function StrFormat(temp, dataarry) {
return temp.replace(/\{([\d]+)\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { if (s instanceof (Date)) { return s.getTimezoneOffset() } else { return encodeURIComponent(s) } } else { return "" } });
}
function StrFormatNoEncode(temp, dataarry) {
return temp.replace(/\{([\d]+)\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { if (s instanceof (Date)) { return s.getTimezoneOffset() } else { return (s); } } else { return ""; } });
}
function getiev() {
var userAgent = window.navigator.userAgent.toLowerCase();
$.browser.msie8 = $.browser.msie && /msie 8\.0/i.test(userAgent);
$.browser.msie7 = $.browser.msie && /msie 7\.0/i.test(userAgent);
$.browser.msie6 = !$.browser.msie8 && !$.browser.msie7 && $.browser.msie && /msie 6\.0/i.test(userAgent);
var v;
if ($.browser.msie8) {
v = 8;
}
else if ($.browser.msie7) {
v = 7;
}
else if ($.browser.msie6) {
v = 6;
}
else { v = -1; }
return v;
}
$(document).ready(function() {
var v = getiev()
if (v > 0) {
$(document.body).addClass("ie ie" + v);
} });
Js 根据不同浏览器弹出窗口的更多相关文章
- IE浏览器弹出窗口
//弹出一个对话框 参数的顺序: url, iWidth, iHeight, vArguments function openDialog() { var url, len = arguments.l ...
- Js(Jquery)实现的弹出窗口
想实现一个弹出层,过一段时间自动消失的功能. 之前的项目中是:在页面中预先先一个<div>区域,默认隐藏或者因为没有内容不显示.当需要显示信息时,将该<div>填充上内容,并用 ...
- JS点击按钮弹出窗口
由于没有系统学习过JS,遇到一个需求:点击按钮,弹出一个独立的窗口. 在网上百度了一下,并没有找到满意的结果,最重要的是各种方法很复杂.最终,仔细研究了一下,原来只是需要只要一个简单的函数就能满足自己 ...
- Skyline Terra Explorer6.6弹出窗口实现复制功能
前段时间继续下来的基于Skyline的B/S项目,是基于Terra Explorer6.6实现的.项目中涉及到基于三维模型查询设备编码等操作,从用户友好角度来讲,查询到的设备编码应该要支持复制,方便用 ...
- window.open()弹出窗口防止被禁
window.open(),顾名思义,是指在当前浏览器窗口弹出另一个浏览器窗口. 因为多种原因,浏览对window.open弹出的窗口做了多方限制.限制不同,肯定会造成各浏览器弹出窗口的差异. 大部分 ...
- [转]js来弹出窗口的详细说明
1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...
- jquery-通过js编写弹出窗口
本文转载 本文主要是通过js动态控制div的高度,css控制浮动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...
- js弹出窗口总结6种弹窗方法
注: //关闭,父窗口弹出对话框,子窗口直接关闭 this.Response.Write("<script language=javascript>window.close(); ...
- JS弹出窗口代码大全(详细整理)
1.弹启一个全屏窗口 复制代码代码如下: <html> <body http://www.jb51.net','脚本之家','fullscreen');">; < ...
随机推荐
- excel单元格内换行
强制换行:将光标置于拟换行处,按ALT+Enter键,即可强行换行.
- 微信小程序-数据缓存
每个微信小程序都可以有自己的本地缓存,可以通过 wx.setStorage(wx.setStorageSync).wx.getStorage(wx.getStorageSync).wx.clearSt ...
- Git_1基础操作,从安装到提交完成(windows)
github地址:https://github.com/zhangsai521314/Git 1:安装Git Bash(https://git-scm.com/),安装一路NEXT. 2:目录架构: ...
- 获取Echarts的DataZoom的起始值
创建DataZoom拖动事件 myChart.on(ecConfig.EVENT.DATA_ZOOM, eConsole); //事件名, 相关联的方法名 var ecConfig = requi ...
- [地图SkyLine二次开发]框架(4)
继续上一节... 1.Extjs5.0版Menu. -将Extjs包引入MenuPage.html页. 2.前段用Extjs的MVC框架 -在根目录下创建app文件夹,文件夹下分别创建controll ...
- [地图SkyLine二次开发]框架(1)
项目介绍: 项目是三维地理信息系统的开发,框架MVC4.0 + EF5.0 + Extjs4.2 + SkyLine + Arcgis,是对SkyLine的二次开发. 项目快结束了,先给大家看一眼效果 ...
- 正确使用ng-if和ng-show
在使用bootstrap中,我们会经常用到按钮组,也就是btn-group,如果仔细观察的话,会发现一个按钮组的第一个和最后一个按钮分别是有圆角的,如下图: 但是中间的按钮是没有圆角的,这样显得比较美 ...
- php操作redis简单例子
<?php //在PHP里操作Redis //Redis就是php的一个功能类 //创建Redis对象 $redis = new Redis(); //链接redis服务器 $redis -&g ...
- Java四种线程池
Java四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecutor 时间:20 ...
- hdu 5587 Array
题目链接:hdu 5587 前两周 bc 上的题了,因为赶大作业所以没有去打,看了下官方给出的思路,感觉好强大~~竟然能转化成求二进制数 1 的个数: 然后数位 dp 就行了, #include< ...