English 中文(简体)
IE 7 + jQuery 1.3.2 错误
原标题:IE 7 + jquery 1.3.2 errors

我在网页中有以下代码。有时jQuery可以正常加载,但有时会出现错误:jQuery未定义

<script src="/javascripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui-1.7.1.custom.min.js"    
type="text/javascript"></script>

<script type="text/javascript">
alert( test )
var $j = jQuery.noConflict();
alert( test1 )
//start when document is ready
$j(document).ready(function(){
alert( test2 )

当j Query不装载时,只见网页上的第一个alert。 因此,我想到的是,Qu子从未装满。 另外,我还在使用“不许可”一词,因为在此之前,我已经弄错了<条码>美元,没有界定。 我没有像原型或任何东西一样使用任何其他支离破碎的图书馆。 因此,我没有必要使用<代码>j。 不适用。

有人在使用jQuery和IE 7时遇到这些问题吗?这个错误在Firefox上没有发生。

有没有办法来修复这个问题?

Update I decided to make use of jQuery + jQuery UI hosted on Google. which worked for me.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
问题回答

如果你没有其他相互矛盾的图书馆,那么<代码>美元是未界定的 ,那么大概意味着贵方的书记图书馆路不正确,或者说 j已经准备好。 本案没有理由使用冲突功能。

试试这个:

<script src="/path to your/jquery-1.3.2.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function() {

        alert("jquery is ready.");

    });
</script>

如果警报触发,您就知道jQuery已正确引用和初始化。

如果没有,则尝试这些选择:

  • Try using Firefox with Firebug to check that the script path is correct (you ll be able to actually load up the script file in the firebug pane)
  • Use the non-minified version of jQuery in development, to ensure there are no issues there

如果在其他浏览器中也发生这种情况,那么我首先猜测您的Jquery库的URL路径不正确(javascriptsjavascript)。尝试将库的完整URL放入并查看结果。

「noConflict声明是否正确?我认为应该是」

var j = jQuery.noConflict();
....
j(document).ready(function(){....}




相关问题
Image rendered with wrong colors in IE8

I have a gradient image as a PNG (no transparency) in a web-page. By taking a screenshot of Chrome showing the page and cropping the image from the page, I see the exact same colors are drawn as the ...

Determine Mobile Internet Explorer version

I need to determine the version of Mobile Internet Explorer on a Windows Mobile 6.1 device. So that I can report the same user-agent string as is being used by Mobile Internet Explorer. The user-...

CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

Internet Explorer only part loading JavaScript/CSS

I m having trouble with my local development environment where IE (6 through to 8) is only part loading JavaScript/CSS files. It throws random errors at random places in jquery.min.js every time I ...

IE doesn t run Javascript when you click back button

I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...

热门标签