弄成下面这样就不会错了:
window.onload=function(){
var list_li = document.getElementById(‘list-banner‘).getElementsByTagName(‘li‘);
//...其他代码自己加...
}
js报错Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
原文:https://www.cnblogs.com/Xieyingpeng/p/15032529.html