为什么报错,出现Cannot read property 'length' of null at switchSlider (index.html:212) at window.onload (index.html:224)
//5.3清除他们的active样式
for(i=0;i<clear_ctrl.length;i++){
clear_main[i].className = clear_main[i].className.replace('main-i_active','');
clear_ctrl[i].className = clear_ctrl[i].className.replace('ctrl-i_active','');
}
//5.4为当前控制按钮和幻灯片附加样式
main.className += 'main-i_active';
ctrl.className += 'ctrl-i_active';
}
//4.定义何时处理幻灯片输出
window.onload=function(){
addSliders();
switchSlider(1);
}