/// <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 根据不同浏览器弹出窗口的更多相关文章

  1. IE浏览器弹出窗口

    //弹出一个对话框 参数的顺序: url, iWidth, iHeight, vArguments function openDialog() { var url, len = arguments.l ...

  2. Js(Jquery)实现的弹出窗口

    想实现一个弹出层,过一段时间自动消失的功能. 之前的项目中是:在页面中预先先一个<div>区域,默认隐藏或者因为没有内容不显示.当需要显示信息时,将该<div>填充上内容,并用 ...

  3. JS点击按钮弹出窗口

    由于没有系统学习过JS,遇到一个需求:点击按钮,弹出一个独立的窗口. 在网上百度了一下,并没有找到满意的结果,最重要的是各种方法很复杂.最终,仔细研究了一下,原来只是需要只要一个简单的函数就能满足自己 ...

  4. Skyline Terra Explorer6.6弹出窗口实现复制功能

    前段时间继续下来的基于Skyline的B/S项目,是基于Terra Explorer6.6实现的.项目中涉及到基于三维模型查询设备编码等操作,从用户友好角度来讲,查询到的设备编码应该要支持复制,方便用 ...

  5. window.open()弹出窗口防止被禁

    window.open(),顾名思义,是指在当前浏览器窗口弹出另一个浏览器窗口. 因为多种原因,浏览对window.open弹出的窗口做了多方限制.限制不同,肯定会造成各浏览器弹出窗口的差异. 大部分 ...

  6. [转]js来弹出窗口的详细说明

    1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...

  7. jquery-通过js编写弹出窗口

    本文转载 本文主要是通过js动态控制div的高度,css控制浮动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...

  8. js弹出窗口总结6种弹窗方法

    注: //关闭,父窗口弹出对话框,子窗口直接关闭 this.Response.Write("<script language=javascript>window.close(); ...

  9. JS弹出窗口代码大全(详细整理)

    1.弹启一个全屏窗口 复制代码代码如下: <html> <body http://www.jb51.net','脚本之家','fullscreen');">; < ...

随机推荐

  1. MyEclipse中的SVN操作手册

    原文出处:http://blog.sina.com.cn/s/blog_8a3d83320100zhmp.html 1.导入项目 点击工具栏上的[File-Import],进入下图 (如果你的对话框中 ...

  2. python 生成器生成杨辉三角

    用Python写趣味程序感觉屌屌的,停不下来 #生成器生成展示杨辉三角 #原理是在一个2维数组里展示杨辉三角,空的地方用0,输出时,转化为' ' def yang(line): n,leng=0,2* ...

  3. Linux解读

    Linux中权限(r.w.x)对于目录与文件的意义 一.权限对于目录的意义 1.首先要明白的是目录主要的内容是记录文件名列表和子目录列表,而不是实际存放数据的地方. 2.r权限:拥有此权限表示可以读取 ...

  4. RabbitMQ详解

    本文地址:http://www.host900.com/index.php/articles/351/ 介绍RabbitMQ前,有必须先了解一下AMQP协议.AMQP协议是一个高级抽象层消息通信协议, ...

  5. DuiLib 源码分析之CDuiString

    duilib是一个比较常见的界面库,闲来无事看看别人写的代码,跟自己写的一比, 才看到了差距呀,感觉自己写的乱七八糟,keep moving CduiString是duilib提供的一个字符串类,功能 ...

  6. ie6、7 下input的边框问题 ?

    input的border设置为none,ie8及以上border都兼容,ie6和7的border还继续存在,将border设为0时所有浏览器上都不存在了,但是border为0时还是会继续的渲染. 将i ...

  7. git命令大集合

    git 使用整理 密钥生成 cd ~/.ssh //检查本机中是否有公钥信息 mkdir key_backup cp id_rsa*key_backup rm id_rsa //删除已有公钥 &quo ...

  8. 转:Java中abstract和interface的区别

    转自:Java中abstract和interface的区别 abstract class和interface是Java语言中对于抽象类定义进行支持的两种机制,正是由于这两种机制的存在,才赋予了Java ...

  9. PageObject小结

    写之前想把这次的灵感记录下来: 之前看PO模式几次,始终不得法,感觉一片混乱,可就在一天早上,正在照着别人的代码写自己项目时突然脑海中想通了几个问题:1.为什么要封装页面.2.各个模块的作用以及为什么 ...

  10. SQL Developer新建连接

    1.打开SQL Developer,新建sys连接(sys为系统管理员拥有最高权限): 2.新建system连接(system为本地管理员,拥有次高权限): 3.新建scott(scott为普通用户, ...