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();
}
TypeError: Cannot red property 'style' of null 错误解决的更多相关文章
- day01-JavaScript中"Uncaught TypeError: Cannot set property 'innerHTML' of null"错误
转行学开发,代码100天.初写了最简的一段Js代码,即通过document中的innerHTML方法修改一个<p>标签的内容,报以下错误. -"Uncaught TypeErro ...
- Uncaught TypeError: Cannot read property 'length' of null错误怎么处理?
Uncaught TypeError: Cannot read property 'length' of null 错误怎么处理? 1.可能是返回的datagrid数据格式有问题,比如{"t ...
- JavaScript中"Uncaught TypeError: Cannot set property 'innerHTML' of null"错误
写了一个函数,在调用时出错:"Uncaught TypeError: Cannot set property 'innerHTML' of null" 代码如下: <!DOC ...
- 前台报错:Uncaught TypeError: Cannot read property '0' of null
错误现象: var div1=mycss[0].style.backgroundColor; //这一行提示360和chrome提示:Uncaught TypeError: Cannot read ...
- Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
在开发Ext 项目中如果遇到 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null 这个错误,检查下renderT ...
- Uncaught TypeError: Cannot set property 'innerHTML' of null
学习Chrome插件时,要在弹出页面中显示当前时间,结果怎样也显示不出来 看了 http://www.cnblogs.com/mfryf/p/3701801.html 这篇文章后感悟颇深 通过调试发现 ...
- Three.js three.js Uncaught TypeError: Cannot read property 'getExtension' of null
在调试Three.js执行加载幕布的时候,突然爆出这个错误three.js Uncaught TypeError: Cannot read property 'getExtension' of nul ...
- JavaScript Uncaught TypeError: Cannot read property 'value' of null
用 JavaScript 操作 DOM 时出现如下错误: Uncaught TypeError: Cannot set property 'value' of null Uncaught TypeEr ...
- vue-cli +echarts-amap集成echarts和高德地图TypeError: Cannot read property 'dataToPoint' of null解决方案
由于项目的需求,需要做一种迁徙效果, 最后我们采用了组件化开发,可以说这个坑自己一个人踩,有点累,但也收获不少. vue-cli +echarts-amap集成echarts和高德地图,出现报错,错误 ...
随机推荐
- IDEA快捷键 日常整理
F9 : debug Ctrl+” +/- ” : 当前方法展开.折叠 Ctrl+Shift+”+/-” : 全部展开.折叠 Alt+1 : 工程面板 Alt+4:控制台 Alt+7:查看本类方法 S ...
- Java中子类对象初始化的过程
Java中的继承机制看似简单,实际上包含了很多细节.最近在刷题过程中屡屡跳坑,于是自己仔细再学习了一下Java中子类初始化的细节,与大家分享. class Father { Father(){}; } ...
- 创建Gitblit本地服务器(For windows )01
1.先下载gitblit 貌似需要FQ,百度云链接https://pan.baidu.com/s/1WUtBswj5TkFFcd_hiFFCcw,提取码: xr9n .因为gitblit是基于jav ...
- arduino 引脚作为输入时的不稳定 解决方案
问题描述: arduino引脚作为输入状态时,高低电平不稳定 出现的原因: arduino 引脚为输入时,引脚电平处于悬空状态,容易受外部电荷信号等干扰 解决的方案: 再程序配置为输入状态后 使用下拉 ...
- DOS命令 学习笔记
将遇到的一些DOS命令(linux命令和DOS命令都存在的命令也记录在此处)记录下,方便以后查询 DOS命令计算文件md5/sha1/sha256 certutil -hashfile yourfil ...
- python turtle库
turtle库初步 先看 https://www.cnblogs.com/chy8/p/9448606.html 一 turtle库介绍 turtle乌龟 import turtle from tur ...
- LAPM 相关实验01
目录 lab1 静态.动态资源的区别lab2 部署phpMyadminlab3 部署wordpresslab4 编译安装php-Xcache加速器lab5 fcgi实现lamp lab1 静态.动态资 ...
- web应用与web框架
一.web应用 对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. import socket def handle_request(client ...
- pycharm的console显示乱码和中文的配置
第一种方式: 在python脚本开始的地方加入指定编码方式 # -*- coding : UTF-8 -*- 第二种方式: 有些时候我们会得到这种格式的字符串: "name": & ...
- 2.0vue导出excel
如果没有插件导入 import FileSaver from 'file-saver' import XLSX from 'xlsx'导入依赖 import FileSaver from 'file- ...