getElementByTagName not working?

前端 未结 3 1291

In the code below, I am applying a different background color to all even rows by dynamically assigning the class \"even\" to them using javascript. I am calling the alternamte(

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-21 12:49

    getElementsByTagName() returns an array matching the selector. Hence try

    var table = getElementsByTagName('table')[indexnumber];
    

提交回复
热议问题