简体   繁体   English

IE8上的jquery(null为null或不是对象)错误

[英]jquery (null is null or not an object) error on IE8

When I load jquery using: 当我使用以下方式加载jquery时:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

it works on IE9, firefox, chrome, safari but not IE8. 它适用于IE9,firefox,chrome,safari但不适用于IE8。 I tried the developer/debugger tools but still don't understand why this is an issue. 我尝试了开发人员/调试工具,但仍然不明白为什么这是一个问题。

This is the character code jquery supposedly has error on: 32039. 这是字符代码jquery据说有错误:32039。
On that line there is such function: 在那一行有这样的功能:

G=function(a){
   var b=F.exec(a);
   b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));
   return b
}

Anyone came across this issue as well? 有人也遇到过这个问题吗?

The site is http://www.kanersan.com 该网站是http://www.kanersan.com

I am not calling jquery before it is loaded and I'm loading it inside the head tag. 我没有在加载之前调用jquery,而是在head标签中加载它。

This is a bug in jQuery 1.7.1 when used with SyntaxHighlighter 当与SyntaxHighlighter一起使用时,这是jQuery 1.7.1中的一个错误

http://bugs.jquery.com/ticket/10961 http://bugs.jquery.com/ticket/10961

So you have to upgrade jQuery to 1.7.2 and everything will be working fine. 所以你必须将jQuery升级到1.7.2,一切都会正常工作。

try to folow some steps:- 尝试遵循一些步骤: -

1.jQuery is not being loaded, this is not likely specific to IE8. 1.jQuery没有加载,这可能不是特定于IE8。 Check the path on your jQuery include. 检查jQuery包含的路径。 statement. 声明。 Or better yet,.. TRy to give direct path. 或者更好的是,..试着直接路径。

2.May be because of compatibility issue.. Try to give compatibility solutions.. Things worked in IE6, Firefox, and IE8 running in IE7 compatibility mode; 2.可能是因为兼容性问题。尝试提供兼容性解决方案。在IE7,Firefox和IE8中运行的东西在IE7兼容模式下运行; but not in 'normal' IE8. 但不是'正常'的IE8。 My solution was to put this code in the header 我的解决方案是将此代码放在标题中

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

As to why jquery isn't working in IE8 I'm unclear. 至于为什么jquery不能在IE8中工作,我不清楚。

3.Try to load your jquery on window load. 3.尝试在窗口加载时加载jquery。

4.Try to define your jquery file in top.. 4.尝试在顶部定义你的jquery文件..

5.Very important point - try to check your html and jquery code.. IE is very sensetive for code.. so cross check your Html code ,... Is everything is fine.. 5.非常重要的一点 - 尝试检查你的html和jquery代码.. IE是非常敏感的代码..所以交叉检查你的Html代码,...一切都很好..

6.Changing browser sercurity level to allow executing external javascript code. 6.更改浏览器安全级别以允许执行外部JavaScript代码。

7.Replicate javascript framwork.. 7.重复javascript框架..

May this will help You !!!!!!!!1 愿这会帮助你!!!!!!!! 1

Some things worth trying... 一些值得尝试的事情......

  • Remove type="text/javascript" like so: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 像这样删除type="text/javascript"<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

  • Make sure you reference jquery.min.js before your javascript code that uses jQuery. 确保使用jQuery的javascript代码之前引用jquery.min.js

Most probably, the above suggestions will not help, but since the problem sounds IE8 specific, I believe it's worth a try doing some trivial things that might solve the problem. 最有可能的是,上述建议无济于事,但由于这个问题听起来与IE8有关,我认为值得尝试做一些可能解决问题的琐碎事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM