解决Easyui1.3.3 IE8兼容性问题

事先声明:项目在Firefox和Chrome上完美运行,在MSIE9、MSIE10上基本没问题,但是放在MSIE8上面运行问题就出来了。登录系统后,系统页面跳动,导致系统无法使用;我使用的是Easyui1.3.3。经过网上查找N久,最终解决MSIE8的兼容性问题(客户是国企,他们都是使用的MSIE8没办法必须解决问题)。

Jquery EasyUI 怎么使用这里就不做介绍了,官网地址:http://www.jeasyui.com/

1、常见错误提示如下

详细内容如下:

用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0;
.NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; InfoPath.2; MS-RTC LM 8; .NET4.0C; .NET4.0E)
时间戳:
Fri, 22 Nov 2013 05:46:30 UTC

消息:
对象不支持此属性或方法
行: 4
字符: 6102
代码:
0
URI:
http://localhost/wtms/jquery.min.js

消息: ‘jQuery‘
未定义
行: 12
字符: 1
代码:
0
URI:
http://localhost/wtms/jquery.easyui.min.js

消息:
缺少对象
行: 19
字符: 1
代码:
0
URI:
http://localhost/wtms/demo/dialog/toolbarbuttons.html

2、确认使用正确的Jquery版本。

Easyui下有个jquery.min.js,这个不能使用,需替换为jquery-1.10.2.min.js文件。

jquery-1.10.2.min.js:   jquery官方下载1.10.2最新版本

3、EasyUI的主题切换cookie.


changeTheme = function(themeName) {
var $easyuiTheme = $(‘#easyuiTheme‘);
var url = $easyuiTheme.attr(‘href‘);
var href = url.substring(0, url.indexOf(‘themes‘)) + ‘themes/‘ + themeName + ‘/easyui.css‘;
$easyuiTheme.attr(‘href‘, href);

var $iframe = $(‘iframe‘);
if ($iframe.length > 0) {
for ( var i = 0; i < $iframe.length; i++) {
var ifr = $iframe[i];
$(ifr).contents().find(‘#easyuiTheme‘).attr(‘href‘, href);
}
}

$.cookie(‘easyuiThemeName‘, themeName, {
expires : 7
});

//location.reload();//注释掉是因为页面在MSIE8中跳动,无法正常显示
};

此文件需要jquery-1.5.2.min.js支持,另外还需要:jquery.coner.js和jquery.cookie.js支持。

jquery.cookie.js的代码如下:

/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/

/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie(‘the_cookie‘, ‘the_value‘);
* @desc Set the value of a cookie.
* @example $.cookie(‘the_cookie‘, ‘the_value‘, {expires: 7, path: ‘/‘, domain: ‘jquery.com‘, secure: true});
* @desc Create a cookie with all available options.
* @example $.cookie(‘the_cookie‘, ‘the_value‘);
* @desc Create a session cookie.
* @example $.cookie(‘the_cookie‘, null);
* @desc Delete a cookie by passing null as value.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/[email protected]
*/

/**
* Get the value of a cookie with the given name.
*
* @example $.cookie(‘the_cookie‘);
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/[email protected]
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != ‘undefined‘) { // name and value given, set cookie
options = options || {};
if (value === null) {
value = ‘‘;
options.expires = -1;
}
var expires = ‘‘;
if (options.expires && (typeof options.expires == ‘number‘ || options.expires.toUTCString)) {
var date;
if (typeof options.expires == ‘number‘) {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = ‘; expires=‘ + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? ‘; path=‘ + options.path : ‘‘;
var domain = options.domain ? ‘; domain=‘ + options.domain : ‘‘;
var secure = options.secure ? ‘; secure‘ : ‘‘;
document.cookie = [name, ‘=‘, encodeURIComponent(value), expires, path, domain, secure].join(‘‘);
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != ‘‘) {
var cookies = document.cookie.split(‘;‘);
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + ‘=‘)) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

注:页面显示脚本报错主要的原因是jquery存在问题,这里面使用到了两个jquery版本。

时间: 2024-08-28 14:16:42

解决Easyui1.3.3 IE8兼容性问题的相关文章

css解决div的各种浏览器兼容性问题

方法一: 1 min-height:500px;/*解决ie8.9.ff.chromet*/ 2 height:100%;/*解决ie6.7*/ 3 _height:500px;/*解决ie6超出自动溢出*/ 方法二: 1 min-height:400px;/*解决ie8.9.ff.chrome*/ 2 *+height:100%;/*解决ie7*/ 3 _height:400px;/*解决ie6超出自动溢出*/  方法三: 1 min-height:400px; height:auto!imp

解决响应式布局下兼容性的问题

响应式布局主要是为了在各种终端中能正常显示界面,主要是面向的手机.平板等用户的网站比较多采用,而面向PC端的网站很少使用,因为主流的显示器都比较大了,而且大多数网站都采用1000宽度,针对手机端等往往又会另外开发一套前端.因为响应式布局兼容性并不好,在IE8以下的浏览器中无法实现效果.大家宁愿采用1000PX以下宽度的页面. 下面我提供一个办法解决这个问题. 公司最近新的项目中采用了宽屏1200PX的设计,这样就产生了一个问题,在1024*768的显示器上无法正常显示. 所以我额外的写了调整的样

解决HTML5中placeholder属性兼容性的JQuery插件

//调用方法 $(function () {   $(".pHolder").jason(); }); //HTML代码 <input type="text" class="pHolder" placeholder="请输入姓名" /> //jquery插件 ($.fn.jason = function(a) {    var b = {        focus: "black",      

解决div嵌套时IE8和FF无法自适应高度

解决div嵌套时IE8和FF无法自适应高度 还是做类似新浪评论回复的时候,将回复的DIV嵌套在一个DIV中,然后点击回复的时候显示子DIV,这是父DIV的高度是会变化的,于是我将父DIV的高度设置为height:auto;可是问题就出现了,在IE6和IE7下父DIV的高度可以自适应而在IE8和FF下却不可以,于是我开始在网上搜索,嘿嘿,现在的网络知识共享真好,让我找到解决办法了! 在父DIV的CSS中添加两个属性值 clear:both; overflow:auto; OK啦!希望对遇到同样问题

bootstrap IE8 兼容性处理

1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 4 <head> 5 <meta charset="utf-8"> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <meta name="viewport" content="wi

【Javascript】 IE8兼容性问题汇总

本章是在网页开发过程中所碰到的IE8兼容性问题做一个汇总. 尼玛太坑了,屡次踩坑,总是没记性.而且更坑的是IE8的开发者工具太难用了,想调试都调试不出来. 不得已只好记录下来,下次出问题了好方便排查. JS脚本中,必须遵循以下规则,否则都将导致JS脚本在IE8 错误. 1.所有js脚本的语句结束之后,必须以分号结束. 2.数组(Array)对象声明或赋值时,注意不能有多余的逗号(,)如: var arrNum = [1,2,4,]; var arrStr = [ {key:1}, {key:2}

解决&#39;placeholder&#39;针对IE的兼容性问题

if (navigator.userAgent.indexOf("MSIE")>0) {            $("input[placeholder]").each(function(){                $(this).val((($(this).val()=="")?$(this).attr("placeholder"):"")).blur(function(){        

解决IE(IE6/IE7/IE8)不兼容HTML5标签的方法

文章转载自:爱思资源网http://www.aseoe.com/show-10-701-1.html 导语 HTML5新标签在IE6 IE7 IE8上并不能识别,需要进行JavaScript处理.以下就介绍几种方式.方式一:Coding JavaScript<!--[ifltIE9]><script>(function(){if(! *@[email protected]* 0)return;vare="abbr,article,aside,audi HTML5新标签在I

ie8下面margin:0 auto;不能居中的解决方案,ie8兼容性代码

今天写了个div,用margin:0 auto:来定义他的属性,让他居中,结果,竟然无效. 一开始以为是css里的代码冲突了,检查了好几遍,没问题,然后用火狐和谷歌浏览器测试,居中了... 看来是浏览器兼容性的问题,突然想起现在用了win7,ie已经升级到了ie8,看来问题就处在ie8的兼容性上.百度之.... 特将解决方法复制到下面: IE6,7,Firefox下实现居中一般用:margin: auto 来实现,但在IE8下,这是不够的.现提供两种解决的办法: 方法一(推荐): 首先页首必须设