我想大声告诉你2017-07-05 10:38:25
The error is very obvious. There is no style
attribute in
this.contentli[i]
If you are not sure, just print the line aboveconsole.log(this.contentli[i]);
给我你的怀抱2017-07-05 10:38:25
Try console.log(this.contentli[i]). If the returned object is not a DOM object, then the code is wrong. .
欧阳克2017-07-05 10:38:25
The this.contentli[i].style
attribute cannot be accessed because the this.contentli[i]
attribute is undefined, and the .style
of an undefined object cannot of course be accessed.
First check the value of this.contentli[i]
when you run it, and then combine the above code that defines this.contentli[i]
to troubleshoot why this.contentli[i]
is not defined.
曾经蜡笔没有小新2017-07-05 10:38:25
this.contentli[i]
is undefined
, and it should be that the value of i
exceeds this.contentli.length - 1
, which is the maximum subscript of this.contentli
.