当还未载入document时去使用document.getElementById跟insertBefore方法时,会导致null错误,此时应该将js的引入语句放到html文件的末尾

 

<script src="../../static/js/showRecords.js"></script>
</body>
</html>