当前位置: 代码迷 >> Java Web开发 >> !总是报这个异常, ‘nodeName'为空或不是对象
  详细解决方案

!总是报这个异常, ‘nodeName'为空或不是对象

热度:711   发布时间:2016-04-14 21:16:52.0
求救!!!总是报这个错误, ‘nodeName'为空或不是对象
我的页面代码如下:输入用户名、密码正确后就报这个错误: ‘nodeName'为空或不是对象



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="frame/pageInclude.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ include file="frame/pageHeader.jsp"%>
<title>登录</title>
<style type="text/css">
body{
background:url(<%=request.getContextPath()%>/static/images/user_all_bg.gif) repeat-x scroll 50% top #226CC5;
padding:0px;
margin:0px;
}
#loginPanel{
width:592px;
height:372px;
margin:120px auto;
font-size:12px;
}
ul{
padding:0px;
margin:0px;
list-style-type:none;
clear:both;
}
li{
float:left;
padding:0px;
margin:0px;
}
#inputArea{
width:280px;
height:139px;
background:url(<%=request.getContextPath()%>/static/images/user_main_c.gif) no-repeat;
}
#action{
width:180px;
height:139px;
background:url(<%=request.getContextPath()%>/static/images/user_main_r.gif) no-repeat;
}
.userNameStyle{
border-top-width: 0px;
padding-left: 25px;
border-left-width: 0px;
background:url(<%=request.getContextPath()%>/static/images/user_login_name.gif) no-repeat;
border-bottom-width: 0px;
width: 165px;
line-height: 20px;
height: 21px;
border-right-width: 0px;
}
.passwordStyle{
border-top-width: 0px;
padding-left: 25px;
border-left-width: 0px;
background: url(<%=request.getContextPath()%>/static/images/user_login_password.gif) no-repeat;
border-bottom-width: 0px;
width: 165px;
line-height: 20px;
height: 21px;
border-right-width: 0px;
}
#errorMessage{
color:yellow;
}
</style>
<script type="text/javascript">

function validate(){
var $loginName = $('#loginName');
var $password= $('#password');
if($.trim($loginName.val()) == ''){
$.messager.show({
title:'系统提示', 
msg:'请输入登录名。'
});
return false;
}

if($.trim($password.val()) == ''){
$.messager.show({
title:'系统提示', 
msg:'请输入密码。'
});
return false;
}

return true;
}

</script>
</head>
<body onload="document.getElementById('loginName').focus();">
<div id="loginPanel">
        <form action="<%=request.getContextPath()%>/login/index" method="post" onsubmit="return validate();">
            <ul>
                <li style="height:116px;width:129px;background:url(<%=request.getContextPath()%>/static/images/user_top_l.gif);"></li>
                <li style="height:116px;width:280px;background:url(<%=request.getContextPath()%>/static/images/user_top_c.gif);"></li>
                <li style="height:116px;width:180px;background:url(<%=request.getContextPath()%>/static/images/user_top_r.gif);"></li>
            </ul>
            <ul>
                <li style="height:139px;width:129px;background:url(<%=request.getContextPath()%>/static/images/user_main_l.gif);"></li>
                <li id="inputArea">
                    <table>
                        <tr>
                            <td width="100">用户名:</td>
                            <td><input type="text" name="loginName" id="loginName" size="30" class="userNameStyle"/></td>
                        </tr>
                        <tr>
                            <td>密 码:</td>
                            <td><input type="password" name="password" id="password" size="30" class="passwordStyle"/></td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center"><div id="errorMessage">${errorMsg}</div></td>
                        </tr>
                    </table>
                </li>
                <li id="action">
                    <input type="image" src="<%=request.getContextPath()%>/static/images/user_botton.gif" />
                </li>
            </ul>
            <ul>
                <li style="height:117px;width:129px;background:url(<%=request.getContextPath()%>/static/images/user_bottom_l.gif);"></li>
                <li style="height:117px;width:280px;background:url(<%=request.getContextPath()%>/static/images/user_bottom_c.gif);"></li>
                <li style="height:117px;width:180px;background:url(<%=request.getContextPath()%>/static/images/user_bottom_r.gif);"></li>
            </ul>
        </form>
    </div>
</body>
</html>




在firefox下看错误时提示的:
 TypeError:a is undefined
http://localhost:8080/portal/static/jquery-1.4.4-min.js

打开这个js:对应的代码行为:
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,



求各位高手帮忙啊!!!


------解决思路----------------------
LZ你的这行代码
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName)
里面的a是什么???
------解决思路----------------------
<script src="../../jquery-1.4.4-min.js"></script>填上你对应的路径
------解决思路----------------------
nodeName是Dom对象的属性。。。
你是不是对什么jquery对象使用了,这个属性。。。
------解决思路----------------------
加上试试。。。。
------解决思路----------------------
pageInclude.jsp和;另外的jsp文件看下
------解决思路----------------------
那是原代码,还是你代码的问题
------解决思路----------------------

onsubmit="return validate();"改为 onsubmit="validate();"试下