TypeError: Cannot red property 'style' of null 错误解决
错误信息如下:
JSP代码如下:
<c:if test ="${not empty excelErrors}"> <div id="excelErrorDiv" class="acxiom-content-container closed rounded vpad top-buffer" style="width:90%;margin-left:5%;"> <div class="acxiom-table top-buffer" style="display:block;width:80%;margin:10% 0% 10% 10%;"> <div id="handlingExcelError" class="row-fluid" style="font-size:20px; display: block;" > <span style="font-size:20px;"> <font color="#B85F1B"><strong>Warning !!</strong> Importing file has some errors as below:</font> </span> </div> <div class="row-fluid" style="font-size:20px; padding-top:50px;"> <div align="center"> <c:forEach var="excelError" items="${excelErrors}"> <table> <tr> <td>${excelError} </td> </tr> </table> </c:forEach> </div> </div> </div> </div> </c:if>
因为有<c:if >的判断,当excelErrors为空的时候,div不会被加载。
所以js里面的这段话执行就报错了
document.getElementById('excelErrorDiv').style.display = 'block';
解决办法:
js里面修改为:
if($("#excelErrorDiv")){ $("#excelErrorDiv").hide(); }
转载于:https://www.cnblogs.com/annjia/p/4554519.html
TypeError: Cannot red property 'style' of null 错误解决相关推荐
- Uncaught TypeError: Cannot read property 'length' of null错误怎么处理?
Uncaught TypeError: Cannot read property 'length' of null 错误怎么处理? 1.可能是返回的datagrid数据格式有问题,比如{"t ...
- Uncaught TypeError: Cannot read property 'style' of null
报错代码部分: 就是因为这个属性margin-top 必须用双等号的关系来写,代码如下: tophead.style.margin-top == '0';
- 【转】Uncaught TypeError: Cannot set property ' ' of null 错误解决
这是一个前端页面开发中常见的bug,自己也不是第一次遇到了.但是由于自己不是经常写前端代码,所以每次重新遇到都要再回忆一下是原因和解决方案,那就记下来以防下次再遇到吧. bug重现 项目使用Ext组件 ...
- Uncaught TypeError: Cannot read property 'value'' of null
在用JS实现ajax做网页聊天室的时候,报了一个错误: Uncaught TypeError: Cannot read property 'value'' of null at chat (Gluti ...
- (原创)JS点击事件——Uncaught TypeError: Cannot set property 'onclick' of null
html部分代码: JS部分代码: 需要实现的效果:点击图片,来回相互切换. 我开始的错误做法:代码如上图所示(逻辑上看起来是没有错误的) 尝试过程:把JS代码放在</body>闭合标签之 ...
- Error in callback for watcher “value“: “TypeError: Cannot read property ‘repalce‘ of null“
vue空页面value空值问题 在页面后台中,输出了Error in callback for watcher "value": "TypeError: Cannot r ...
- 关于Error in render: TypeError: Cannot read property '0' of null问题的解决方法
关于Error in render: "TypeError: Cannot read property '0' of null"问题的解决方法 //这里是原生代码块,也就是运行该块 ...
- 对于Uncaught TypeError: Cannot set property ‘innerHTML‘ of null 的理解
在w3school自学JavaScript时,发现一个很有意思的问题.首先看下面代码: <!DOCTYPE html> <html> <body><h2> ...
- 使用天地图报错Error in v-on handler: “TypeError: Cannot read property ‘_tdt_events‘ of null
地图官网获取服务许可key:国家地理信息公共服务平台 天地图 vue使用天地图报错Error in v-on handler: "TypeError: Cannot read propert ...
最新文章
- Ajax-基础篇(持续更新01)
- centos linux7修改主机名,CentOS7操作系统下永久修改主机名
- 高龄申请海外计算机科学博士,【原创】牛津在读小博谈谈在海外攻读生命科学专业的一些心得...
- P4171 [JSOI2010]满汉全席
- hdu 1251 统计难题 (字典树入门题)
- 卡拉OK歌词同步播放
- cl.b8y.php,群晖如何重装系统
- 【数据结构】栈和队列的异同
- c语言二进制转换方式,c语言二进制怎么转换十进制
- 函数图像的变换 与 解析式的变换 之关系
- linux内核态文件操作filp_open/filp_close/vfs_read/vfs_write
- linux键盘控制鼠标软件下载,手机控制电脑软件(Mouse Server)
- ip地址转换成16进制long
- 一键安装mysql5.7
- 训练赛一:bfs广搜题目 CF115B Lawnmower
- 基于STM32的移动视频监控系统
- 【转】如何管理PDF书签:Foxit、PDF XChange、PDF补丁丁
- 永辉超市第三季营收222亿:净亏7.8亿 卖金龙鱼股权套现1.7亿
- gitlab添加SSH Key
- 【源码】ConvertTDMS (v10)——将LabView TDMS文件导入或转换到MATLAB工作区或mat文件