相关疑难解决方法(0)

jQuery没有加载,IE8中未定义'$'

我试图用jQuery做一个非常基本的事情,它在IE8中根本不起作用,但在Firefox,Safari和Chrome中工作正常; IE一直给我一个"对象预期".

有人可以帮忙吗?由于页面非常基本,我不确定是什么问题:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.2.min.js"></script>
    <script type="text/javascript">
        $(function() { 
            alert("It works!");
        });
    </script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

IE(和唯一的IE)在加载代码上给出了一个错误,说"对象预期".我有IE开发工具栏并且$未定义但在Firebug中它出现为"功能".真的不知道是什么原因引起的.

jquery internet-explorer-8

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

internet-explorer-8 ×1

jquery ×1