错误信息例如以下:

JSP代码例如以下:

<c:if test ="${not empty excelErrors}">
<div id="excelErrorDiv" style="width:90%;margin-left:5%;">
<div 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 read property &#39;style&#39; of null 错误解决的更多相关文章

  1. TypeError: Cannot red property 'style' of null 错误解决

    错误信息如下: JSP代码如下: <c:if test ="${not empty excelErrors}"> <div id="excelError ...

  2. Uncaught TypeError: Cannot read property &#39;call&#39; of undefined jquery.validate.min.js:28

    最近在做表单验证时,,自己写的addMethod 方法总是不起作用.折腾了将近一天. 报告的错误,如下面的 Uncaught TypeError: Cannot read property 'call ...

  3. DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined

    DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined 原因:table 中定义的列和aoColumns ...

  4. Error解决:Property&#39;s synthesized getter follows Cocoa naming convention for returning &#39;owned&#39;

    在项目中定义了以new开头的textField.结果报错: 先看我的源代码: #import <UIKit/UIKit.h> @interface ResetPasswordViewCon ...

  5. SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序

    SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论   异常汇总:http://www ...

  6. Odoo14 TypeError: Cannot read property 'classList' of undefined

    Traceback: TypeError: Cannot read property 'classList' of undefined at Class.setLocalState (http://l ...

  7. Uncaught TypeError: Cannot read property 'msie' of undefined

    因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...

  8. vue v-if:"TypeError: Cannot read property 'length' of undefined"

    在使用v-if判断一个数组大小为0时,会出现 length 是undefined的错误:[Vue warn]: Error in render: "TypeError: Cannot rea ...

  9. 前台报错:Uncaught TypeError: Cannot read property '0' of null

    错误现象: var div1=mycss[0].style.backgroundColor;  //这一行提示360和chrome提示:Uncaught TypeError: Cannot read  ...

随机推荐

  1. File Templates for web.xml & web-fragment.xml (Servlet 2.3, 2.4, 2.5 + 3.0)

    As I sometimes need these, I have compiled a list of the valid headers of the web.xml and web-fragme ...

  2. 论文阅读笔记 - YARN : Architecture of Next Generation Apache Hadoop MapReduceFramework

    作者:刘旭晖 Raymond 转载请注明出处 Email:colorant at 163.com BLOG:http://blog.csdn.net/colorant/ 更多论文阅读笔记 http:/ ...

  3. inode结构体成员详解

    概述:inode译成中文就是索引节点,它用来存放档案及目录的基本信息,包含时间.档名.使用者及群组等.inode分为内存中的inode和文件系统中的inode,为了避免混淆,我们称前者为VFS ino ...

  4. 让程序在崩溃时体面的退出之Dump文件

             在我的那篇<让程序在崩溃时体面的退出之CallStack>中提供了一个在程序崩溃时得到CallStack的方法.但是要想得到CallStack,必须有pdb文件的支持.但 ...

  5. ufldl学习笔记和编程作业:Feature Extraction Using Convolution,Pooling(卷积和汇集特征提取)

    ufldl学习笔记与编程作业:Feature Extraction Using Convolution,Pooling(卷积和池化抽取特征) ufldl出了新教程,感觉比之前的好,从基础讲起.系统清晰 ...

  6. p类型最大可定义范围

    t7(16) TYPE  p DECIMALS 14,

  7. 慎用MonthsBetweent和MonthSpan

    ●function MonthsBetween(const ANow, AThen: TDateTime): Integer; 描述: 根据两个给定的TDateTime类型的参数ANow和AThen, ...

  8. String 中的秘密

    Navigation:  数据类型相关 > Delphi 的字符及字符串 > [3] - String 中的秘密   //String 的指针地址及实际的内存地址 var str: str ...

  9. innerXml,outerXml,innerText的不同

    原文:innerXml,outerXml,innerText的不同 昨天看到咱们园子里有一个仁兄写的关于xml的有关操作,在读的过程中,由于是初学者有不明白的地方就查资料,发现自己多innerXml, ...

  10. CentOS6.4 安装Mysql

    虽说,新版的数据包可能会带上一些新特性,但是数据库对我而言,还是稳定版优先.因为新特性不一定我会用到.. 下载安装: yum list | grep mysql 因为是准备搞开发用的,所以只要安装my ...