DOM中获取childNodes.length应该放入局部变量中iechildNodes.length看上去是childNodes.length属性读取实际上是对实时遍历计算的。

for(i=0;i< childnodes.length;i++)

{

}

高效的写法是:

Var lenth =childnodes.length;

for(i=0;i<lenth;i++)

{

}

相关文章:

  • 2021-07-17
  • 2022-12-23
  • 2022-02-26
  • 2021-08-03
  • 2022-12-23
  • 2022-02-23
  • 2021-06-14
  • 2022-03-07
猜你喜欢
  • 2021-07-08
  • 2021-11-29
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案