任何人都知道为什么window.location在ie8(也许ie7也是)中未定义,但作为document.location?window.location在ie8中是未定义的
我找不到为什么另一个文件,从其他项目有一个类似的代码,但没有与IE浏览器的问题。
我也得到一个奇怪的错误:'window.location.hash为空或不是jquery 1.6.4第2行中的对象'。我也试过1.5.1,但同样的错误。
标题:
<html lang="">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="assets/css/style.css">
<script src="assets/js/jquery.1.6.4.min.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="assets/js/jquery.easing.1.3.js"></script>
<script src="assets/js/jquery.ba-hashchange.min.js"></script>
<script src="assets/js/script.js"></script>
</head>
JS部分:
if(window.onhashchange)
{
window.onhashchange = function()
{
hashChanged(window.location.hash);
}
}
else
{
var storedHash = window.location.hash;
window.setInterval(function()
{
if(window.location.hash != storedHash)
{
storedHash = window.location.hash;
hashChanged(storedHash);
}
}, 100);
}
你是否缺少'<!DOCTYPE html>'或者你没有粘贴? – canon
它只是*在IE中的问题?或其他浏览器呢?你有没有名为'location'的变量? – user113716
只是IE。是这样的,@Ӫ_._Ӫ –