Cannot set property 'innerHTML' of null 问题的解决

错误
第一次写web 前端代码,出现了“Cannot set property ‘innerHTML’ of null”的错误代码,然后不知道原因在哪?

解决方案
在网上查了下资料,原来是js 代码从上往下执行时,没有找到合适的标签而出错。类似于在编程中使用一个未定义的变量,所以一定要在使用变量之前对其进行定义。


参考链接:http://stackoverflow.com/questions/18239430/cannot-set-property-innerhtml-of-null

posted @ 2019-02-18 18:16  Ryan_zheng  阅读(6740)  评论(0编辑  收藏  举报