【发布时间】:2011-01-21 23:23:53
【问题描述】:
我有以下代码,它在除 IE 之外的所有东西中都可以正常工作(像往常一样)。它给了我一个对 Jquery 中方法或属性访问的意外调用,我不知道如何调试它。我一直在使用 IE 开发人员工具栏,这对这个错误毫无用处,只是给了我第 12 行(在 jquery 脚本内)。
非常感谢任何帮助:
<script type="text/javascript">
$(document).ready(function () {
$.history.init(pageload);
$('a[href=' + window.location.hash + ']').addClass('selected');
$('a[rel=ajax]').click(function () {
var hash = this.href;
hash = hash.replace(/^.*#/, '');
$.history.load(hash);
$('a[rel=ajax]').removeClass('selected');
$(this).addClass('selected');
$('.loading').show();
getPage();
return false;
});
});
function pageload(hash) {
if (hash) getPage();
}
function getPage() {
hash = document.location.hash;
hash = hash.replace(/^.*#/, '');
var data = 'page=' + encodeURIComponent(hash);
$.ajax({
url: "index.php",
type: "POST",
data: data,
cache: false,
success: function (html) {
$('.loading').hide();
$('tbody').html(html);
}
});
}
</script>
这里是历史插件:http://plugins.jquery.com/project/history
这是我一直关注的演示: http://plugins.jquery.com/project/history
仍然将 window.location 改回 document.location 似乎没有什么不同
我迷路了。当我更改我正在调用的标签时,它确实发布了,所以它正在工作,但在 IE 中,设计都被破坏了,我点击的下一个链接不发布。真的很奇怪!!在 Firefox、Opera 等中运行良好。
【问题讨论】:
标签: javascript jquery internet-explorer methods