我正在检查 JS 控制台,它帮助我解决了一些小问题,但我想知道这个警告是否值得严重担心?
这是给出错误的代码:
<script type="text/javascript"
src="https://www.safaviehhome.com/product_images/locations/js/jqgalscroll.js"></script>
<script src="https://www.safaviehhome.com/product_images/mainnav/stuHover.js" type="text/javascript"></script>
<script>
function layerSetup(id,visibility){
if(document.getElementById){
this.obj = document.getElementById(id).style;
Uncaught TypeError: Cannot read property 'style' of null
Uncaught TypeError: Cannot read property 'style' of null
<!--Includes many more of the same "Cannot read property 'style' of null messages -->
this.obj.visibility = visibility;
return this.obj;}
else if(document.all){
this.obj = document.all[id].style;
this.obj.visibility = visibility;
return this.obj;}
else if(document.layers){
this.obj = document.layers[id];
this.obj.visibility = visibility;
return this.obj;}
}
function visVisible(param){
new layerSetup(param,'visible');
}
function visHidden(param){
new layerSetup(param,'hidden');
}</script>
我无法真正弄清楚为什么会发生这种情况,以及我是否应该担心,因为我们的地毯类别运行良好。任何人都可以提供任何见解吗?我很抱歉没有提供任何我自己的解释,但我没有写这个 JS 以前的同事做过,现在由我来调试他犯的每一个错误。这是一个学习过程,但我对此还是有些陌生..