Uncaught TypeError: Cannot read property 'getElementsByTagName' of nulljavascript
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../css/index.css">
<!--這一種是在底部加載類容-->
<script src="../js/index.js"></script>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="main" id="main">
<!--圖片輪播-->
<div class="banner" id="banner">
<a href="">
<div class="banner-slide slide1 slide-active"></div>
</a>
<a href="">
<div class="banner-slide slide2"></div>
</a>
<a href="">
<div class="banner-slide slide3"></div>
</a>
</div>
<!--上一張,下一章圖片-->
<a href="javascript:void(0);" class="button pre"></a>
<a href="javascript:void(0);" class="button next"></a>
<!--設置小圓點-->
<div class="dots">
<ul>
<span class="active"></span>
<span></span>
<span></span>
</ul>
</div>
</div>
</body>
</html>
複製代碼
更改後的代碼css
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../css/index.css">
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="main" id="main">
<!--圖片輪播-->
<div class="banner" id="banner">
<a href="">
<div class="banner-slide slide1 slide-active"></div>
</a>
<a href="">
<div class="banner-slide slide2"></div>
</a>
<a href="">
<div class="banner-slide slide3"></div>
</a>
</div>
<!--上一張,下一章圖片-->
<a href="javascript:void(0);" class="button pre"></a>
<a href="javascript:void(0);" class="button next"></a>
<!--設置小圓點-->
<div class="dots">
<ul>
<span class="active"></span>
<span></span>
<span></span>
</ul>
</div>
</div>
<!--這一種是在底部加載類容-->
<script src="../js/index.js"></script>
</body>
</html>
複製代碼