在调试JS代码的过程中遇到错误:Cannot read property ‘getElementsByTagName’ of null
如下图:
修改为:document.getElementsByTagName(’li’);
原因:getElementsByTagName是document的方法,只能通过document调用
Cannot read property 'getElementsByTagName' of null
最新推荐文章于 2025-03-06 21:56:32 发布