原型Javascript错误(仅在IE中)';对象没有';不支持此属性或方法';

原型Javascript错误(仅在IE中)';对象没有';不支持此属性或方法';,javascript,internet-explorer,prototypejs,Javascript,Internet Explorer,Prototypejs,我们的一个开发人员通过一个横幅旋转器,虽然它在非IE中运行良好,但IE在第30行抛出了一个错误(下面用“******下一行错误”标记)。我不能对$$('.banner')进行排序吗 错误是: “对象不支持此属性或方法” 使用原型1.6.0.3 function changeBanners() { // banners are now sorted by their z index so that // the ones most in front should be most on t

我们的一个开发人员通过一个横幅旋转器,虽然它在非IE中运行良好,但IE在第30行抛出了一个错误(下面用“******下一行错误”标记)。我不能对$$('.banner')进行排序吗

错误是: “对象不支持此属性或方法”

使用原型1.6.0.3

function changeBanners() {

  // banners are now sorted by their z index so that
  // the ones most in front should be most on top in the DOM
  // ***** ERROR ON NEXT LINE

  banners = $$('.banner').sort(function (a,b){
    _a = parseInt(a.style.zIndex);
    _b = parseInt(b.style.zIndex);
    return _a < _b ? 1 : _a > _b ? -1 : 0;
  });

  // increment z index on all of the banners
  Element.extend(banners);

  banners.each( function (banner){

    Element.extend(banner);
    banner.style.zIndex = parseInt(banner.style.zIndex) + 1;
  });

  // move the first banner to be the last
  first_banner = banners.shift();
  banners.push(first_banner);

  // set it invisible
  Effect.toggle( first_banner.id , 'appear' , {
    duration: 2.0,
    afterFinish: function(){
      first_banner.style.zIndex = 0;  // update its z index so that it is at the end in the DOM also
      first_banner.show();            // make it reappear so that when the one in front of it disappears, it will show through
    }
  });
};
函数更改横幅(){
//横幅现在按z索引排序,以便
//在DOM中最前面的应该是最上面的
//******下一行出错
banner=$$('.banner').sort(函数(a,b){
_a=parseInt(a.style.zIndex);
_b=parseInt(b.style.zIndex);
返回<\u b?1:\u a>\u b?-1:0;
});
//在所有横幅上增加z索引
元素。延伸(横幅);
横幅。每个功能(横幅){
元素。扩展(横幅);
banner.style.zIndex=parseInt(banner.style.zIndex)+1;
});
//将第一个横幅移动到最后一个横幅
first_banner=banner.shift();
横幅。推(第一个横幅);
//设置为不可见
效果.切换(第一个标题“显示”{
持续时间:2.0,
afterFinish:function(){
first_banner.style.zIndex=0;//更新其z索引,使其也位于DOM的末尾
first_banner.show();//使其重新出现,以便当它前面的一个消失时,它将显示出来
}
});
};
*叹气*

毕竟,我不记得在JS中声明变量

更改:

banners = $$('.banner').sort(function (a,b){
    _a = parseInt(a.style.zIndex);
    _b = parseInt(b.style.zIndex);
    return _a < _b ? 1 : _a > _b ? -1 : 0;
  });
banner=$$('.banner').sort(函数(a,b){
_a=parseInt(a.style.zIndex);
_b=parseInt(b.style.zIndex);
返回<\u b?1:\u a>\u b?-1:0;
});
致:

var banner=$$('.banner').sort(函数(a,b){
_a=parseInt(a.style.zIndex);
_b=parseInt(b.style.zIndex);
返回<\u b?1:\u a>\u b?-1:0;
});
很好

唉*

毕竟,我不记得在JS中声明变量

更改:

banners = $$('.banner').sort(function (a,b){
    _a = parseInt(a.style.zIndex);
    _b = parseInt(b.style.zIndex);
    return _a < _b ? 1 : _a > _b ? -1 : 0;
  });
banner=$$('.banner').sort(函数(a,b){
_a=parseInt(a.style.zIndex);
_b=parseInt(b.style.zIndex);
返回<\u b?1:\u a>\u b?-1:0;
});
致:

var banner=$$('.banner').sort(函数(a,b){
_a=parseInt(a.style.zIndex);
_b=parseInt(b.style.zIndex);
返回<\u b?1:\u a>\u b?-1:0;
});

很好

尝试将空函数传递给
sort
方法并检查是否有错误。空函数抛出了“Number Expected”。将a>b作为排序函数返回“对象不支持此属性或方法”错误。Crescent-相同错误-IE可怕的调试器正在“finally{”onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}最后{this.currentlyExecuting=false;}}}})@Jarrett:see@Crescent Fresh-这听起来肯定是我的问题,但我上面使用element.extend进行的修复仍然会产生相同的结果。你有没有看到我可能遗漏的具体内容?谢谢尝试将空函数传递给
sort
方法并检查是否有错误。空函数抛出了“Number Expected”。将a>b作为排序函数返回“对象不支持此属性或方法”错误。Crescent-相同错误-IE可怕的调试器正在“finally{”onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}最后{this.currentlyExecuting=false;}}}})@Jarrett:see@Crescent Fresh-这听起来肯定是我的问题,但我上面使用element.extend进行的修复仍然会产生相同的结果。你有没有看到我可能遗漏的具体内容?谢谢