Cannot read property 'style' of undefined at HTMLLIElement.lis.(anonymous function).onclick

想做一个点击隐藏li标签的简单案例,但是报错Cannot read property 'style' of undefined     at HTMLLIElement.lis.(anonymous function).onclick 

Cannot read property 'style' of undefined at HTMLLIElement.lis.(anonymous function).onclick

一般这种错误都是因为‘style’前面的元素找不到,可以打印一下,发现是undefined,只要将lis[i]替换为this就可以了,this指当前元素lis[i]

Cannot read property 'style' of undefined at HTMLLIElement.lis.(anonymous function).onclick

如有异议,欢迎提出