好吧,我很难解决这个问题,因为我在一些选项卡中使用了此代码,它在除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和IE 9,因为IE 8可以正常工作,而且在IE的控制台中也没有出现任何错误。
好吧,我知道了会发生什么
ul.select('li', 'ol').each(function(el){
所以在这一行中我使用了“ li”和“ ol”,因为该页面没有任何“ ol”,因此IE中的页面无法正常工作,因此我删除了
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句