对象不支持此属性或方法 - Javascript错误

时间:2011-08-12 17:45:58

标签: javascript ajax

大家好,我有一个很好的javascript项目。我开始试图切换一些JavaScript,我在这里得到一个错误:

    function saveComment( id )
{
    $("#commentErrors").css("visibility", "hidden");

    var hashTab = {};
    commentField = document.getElementById("comments-"+id);

    // hard code the constant Node.TEXT_FIELD as its value "3" since
    // IE doesn't support DOM constants correctly
    hashTab["comments"] = commentField.firstChild.nodeType==3
                        ? commentField.innerHTML
                        : commentField.firstChild.value;



    hashTab["id"] = id;
    //hashTab["entryWorkloadYear"] = document.getElementById("entryWorkloadYear").value;  // Where is this element?!

  ----->>>      WhatIfDataAction.saveComment(hashTab,
            {
                callback:saveCommentCallback,
                timeout:60000,
                errorHandler: dwrSessionErrorHandler
            }
        );
}

有什么想法吗?

saveComment看起来像这样:

    public CommentForm saveComment(Map<String,String> properties)
throws Exception
{
EntryBean entry = WhatifCache.fetchEntryFromCache(getSession());
CommentForm form = new CommentForm(properties);
if (form.validate(this))
{
    CommentBean bean = entry.getComment(form.getId());

    bean = CommentBean.deepCopy(bean);

    form.overlayFormData(bean);

    entry.updateComment(bean);
}

return form;

}

1 个答案:

答案 0 :(得分:0)

错误意味着WhatIfDataAction对象没有名为saveComment的方法。