日期:2014-05-19  浏览次数:20683 次

网页弹出警告框 'null'为空或不是对象
打开网页的时候就弹出警告框 'null'为空或不是对象,一天了也没有搞定,求帮助,以下是整个页面文件。用到的是DWR,兄弟姐妹们解救下小弟。再次感谢!

HTML code

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<%@include file="../common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<link href="../style/oa.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../script/public.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/dwr/engine.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/dwr/util.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/dwr/interface/aclManager.js"></script>
<script type="text/javascript">
//授权
function addOrUpdatePermission(field){
    dwr.engine.setAsync(false);
    
    //如果被选择上,则同时选择其"不继承"和"启用"checkbox
    if(field.checked){
        $(field.moduleId+"_USE").checked = true;
        <c:if test="${aclInfo.principalType eq 'User' }">
        $(field.moduleId+"_EXT").checked = true;
        addOrUpdateExtends(field);
        </c:if>
    }

    aclManager.addOrUpdatePermission(
        "${aclInfo.principalType}",
        ${aclInfo.principalId},
        field.moduleId,
        field.permission,
        field.checked
    );
}

//设置用户的继承特性
function addOrUpdateExtends(field){
    aclManager.addOrUpdateUserExtends(
        ${aclInfo.principalId},
        field.moduleId,
        !field.checked
    );
}

//点击启用checkbox
function usePermission(field){
    //如果checkbox被选中,意味着需要更新ACL的状态
    //更新C/R/U/D以及Extends状态
    
    //设置为同步方式,以便DWR依次发出下列请求
    dwr.engine.setAsync(false);
    
    if(field.checked){
        addOrUpdatePermission($(field.moduleId+"_C"));
        addOrUpdatePermission($(field.moduleId+"_R"));
        addOrUpdatePermission($(field.moduleId+"_U"));
        addOrUpdatePermission($(field.moduleId+"_D"));
        <c:if test="${aclInfo.principalType eq 'User' }">
        addOrUpdateExtends($(field.moduleId+"_EXT"));
        </c:if>
    }else{
        aclManager.delPermission(
            "${aclInfo.principalType}",
            ${aclInfo.principalId},
            field.moduleId        
        );
        $(field.moduleId+"_C").checked = false;
        $(field.moduleId+"_R").checked = false;
        $(field.moduleId+"_U").checked = false;
        $(field.moduleId+"_D").checked = false;
        <c:if test="${aclInfo.principalType eq 'User' }">
        $(field.moduleId+"_EXT").checked = false;
        </c:if>
    }
}

function initTable(){
    aclManager.searchAclRecord(
        "${aclInfo.principalType}",
        ${aclInfo.principalId},
        function(datas){
            for(var i=0; i < datas.length; i++){
                var moduleId = datas[i][0];
                var cState = datas[i][1];
                var rState = datas[i][2];
                var uState = datas[i][3];
                var dState = datas[i][4];
                var extState = datas[i][5];
            //alert(extState);
                $(moduleId+"_C").checked = cState == 0 ? false : true;
            alert($(moduleId+"_C").checked);
                $(moduleId+"_R")