请大神帮忙看看这段js代码为什么报错?

qingwadaxia_1 2018-05-03 04:08:33
浏览器 控制台查看一直拼命报错:

Noname3.html:191 Uncaught TypeError: Cannot set property 'innerHTML' of null
at getCurDate (Noname3.html:191)
at <anonymous>:1:1



代码 如下: js代码已经在html下面了 不知道为什么还有这情况
<script>


document.writeln("<div class=\'zxswt-zhongjian\' id=\'zxswt-zhongjian\' style=\'display:none;\'>");
document.writeln(" <a style=\'height:30%;display:block;\' href=\"javascript:;\" rel=\"nofollow\" onclick=\"openZoosUrl('chatwin','&e='+escape('/zt/duihua/'));\">");
document.writeln(" <div class=\'zxswt-zxzx\'>");
document.writeln(" <div class=\'zxswt-juli\'></div>");

document.writeln(" <div class=\'zxswt-juli\'></div> ");
document.writeln(" </div>");
document.writeln(" </a>");

document.writeln("<div class=\"con2\">");
document.writeln(" <div class=\"cl\"></div>");
document.writeln("<ul class=\"find\" style=\"margin-top:10px\">");

document.writeln("</ul>");
document.writeln("<div class=\"clear\"></div>");
document.writeln(" </div>");
/*2*/
document.writeln("<div style=\' max-width:640px; margin:0 auto\'>");
document.writeln("<div class=\'center_d\' style=\'width:100%;position:absolute;top:80%; max-width:640px; margin:0 auto;\'>");
document.writeln(" <div style=\'text-align:center;float:left;width: 50%;\'><a style=\'display:inline-block;padding-left: 22%;padding-right: 22%;border:1px solid #cac5b2;border-radius:5px;color:#FFF;background:#C00;font:16px/30px Microsoft YaHei\' href=\'javascript:void(0)\' onclick=\'openZoosUrl();return false\'>111</a></div>");
document.writeln(" <div style=\'text-align:center; float:left;width: 50%;\'><a style=\'display:inline-block;border:1px solid #cac5b2;border-radius:5px;color:#FFF;background:#C00;font:16px/30px Microsoft YaHei;padding-left: 22%;padding-right: 22%;\' href=\'tel:0527-83239999\'>333</a></div>");
document.writeln(" ");
document.writeln("</div>");
document.writeln("</div>");

document.writeln(" <a target=\'_self\' onclick=\'closeWin();return false;\' href=\'javascript:void(0);\'>");
document.writeln("<div class=\"aclose\" id=\"aclose\" style=\"position:absolute;right:5px;top:5px;cursor:pointer;\">");
document.writeln(" <i style=\"float:right;width:23px;height:23px;margin-left:12px;\"><img src=\"images/aclose.png\" alt=\"\" style=\"float:left\"></i><span style=\"color:#fff;font:14px/22px Microsoft YaHei;\">点击关闭</span>");
document.writeln(" </div>");
document.writeln(" </a> ");


document.writeln("</div>");





function add_zero(temp)
{
if(temp<10) return "0"+temp;
else return temp;
}


function closeWin(){
document.getElementById('zxswt-zhongjian').style.display='none';
document.getElementById("LXB_CONTAINER_SHOW").style.display="block";
clearInterval("showMainSwt()");
}
function showMainSwt(){
document.getElementById('zxswt-zhongjian').style.display="block";
document.getElementById("LXB_CONTAINER_SHOW").style.display="none";
}
setTimeout('showMainSwt()',1000);
setInterval("showMainSwt()",1000);

</script>
...全文
459 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
usecf 2018-05-04
  • 打赏
  • 举报
回复
没有看到LXB_CONTAINER_SHOW定义的地方 你把代码贴全 大家好帮你看
天际的海浪 2018-05-03
  • 打赏
  • 举报
回复
引用 4 楼 qingwadaxia_1 的回复:
引用 2 楼 bbboy8205 的回复:
document.getElementById("LXB_CONTAINER_SHOW") 找不到, 是null
他有这个div啊 上面
没有id为LXB_CONTAINER_SHOW的元素啊
qingwadaxia_1 2018-05-03
  • 打赏
  • 举报
回复
Uncaught TypeError: Cannot read property 'style' of null at showMainSwt (Noname3.html:63) at <anonymous>:1:1
qingwadaxia_1 2018-05-03
  • 打赏
  • 举报
回复
引用 2 楼 bbboy8205 的回复:
document.getElementById("LXB_CONTAINER_SHOW") 找不到, 是null
他有这个div啊 上面
qingwadaxia_1 2018-05-03
  • 打赏
  • 举报
回复
引用 1 楼 functionsub 的回复:
都已经提示的很明显了getCurDate这个方法里报错了。 你贴的代码里完全没有这个方法。 恕在下没那本事猜到你的代码。
不是啊 它是这样报错的: Uncaught TypeError: Cannot read property 'style' of null at showMainSwt (Noname3.html:63) at <anonymous>:1:1
functionsub 2018-05-03
  • 打赏
  • 举报
回复
都已经提示的很明显了getCurDate这个方法里报错了。 你贴的代码里完全没有这个方法。 恕在下没那本事猜到你的代码。
风中的少年 2018-05-03
  • 打赏
  • 举报
回复
document.getElementById("LXB_CONTAINER_SHOW") 找不到, 是null

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧