好吧,我很难弄清楚这一点,问题在于我在我拥有的某些选项卡中使用此代码,它在所有浏览器中都能完美运行,除了 Internet Explorer 10、9,选项卡正在显示,但是当你点击它们,信息不会改变。因此,在查看了错误之后,我发现在 IE 中,如果它没有运行,代码如下:
<script type="text/javascript">
Varien.Tabs = Class.create();
Varien.Tabs.prototype = {
initialize: function(selector) {
var self = this;
$$(selector+' a').each(this.initTab.bind(this));
},
initTab: function(el) {
el.href = 'javascript:void(0)';
if ($(el.parentNode).hasClassName('active')) {
this.showContent(el);
}
el.observe('click', this.showContent.bind(this, el));
},
showContent: function(a) {
var li = $(a.parentNode), ul = $(li.parentNode);
ul.select('li', 'ol').each(function(el){
var contents = $(el.id+'_contents');
//the problem lies here, in IE the if doesn't run
if (el == li) {
el.addClassName('active');
contents.show();
} else {
el.removeClassName('active');
contents.hide();
}
});
}
}
new Varien.Tabs('.product-tabs');
</script>
所以交易是 IF 语句的条件它没有运行,我不知道为什么。
我使用的是 IE 10 和 9,因为 IE 8 运行良好,而且我在 IE 的控制台中也没有收到任何错误。