【发布时间】:2010-10-26 17:23:19
【问题描述】:
我有一个可在 Firefox、Safari 和 Chrome 中运行的脚本。无论出于何种原因,它都无法在 Internet Explorer 中运行。代码相当简单:
<script type="text/javascript">
(function( $ ){
$.fn.tabSwap = function() {
return this.each(function() {
$('.current').removeClass('current');
$(this).addClass('current');
});
};
})( jQuery );
</script>
a fairly simplified page(由 Roatin Marth 发布)上的代码在 IE 6 和 IE 8 中运行良好。my webpage 上的代码在 Internet Explorer 中根本无法运行。
我尝试执行以下简单代码:
<script type="text/javascript">
$('#statistics').tabSwap();
</script>
我收到以下错误:
对象不支持此属性或方法
index.html 行:77
代码:0 字符:2
URI: ...
我网页的链接是:
http://examples.chikachu.com/calculators
有什么想法吗?
【问题讨论】:
-
工作正常:jsbin.com/ulaho#noedit(在 IE6 中测试)。你在看什么?
-
@Roatin Huh...你发给我的链接在 IE8 中工作。我的网站一定有一些更复杂的东西。我会上传我的网站,重新测试,如果仍然无法使用,我会发布一个链接。
-
@Crescent 解决了问题,谢谢 =) 请作为答案发布,以便我可以将其标记为已接受的答案。
标签: javascript jquery internet-explorer