为什么Netbeans突出显示一些未定义的javascript方法

时间:2016-12-02 12:19:03

标签: javascript netbeans methods

我刚开始使用Netbeans。并已导入以前运行的项目以开始。在加载项目时,Netbeans突出显示了许多“问题”,其中大多数涉及类中的某些方法被识别为未定义。

例如:

var farmFile = farmFile || {};
farmFile.toolBarAUIHelp = new toolBarAUIHelp()|| {};

function toolBarAUIHelp(){

   this.helpMessageArray = [];
   this.errorMessageArray = [];

   this.helpMessageArray[ "geoLocationTitle" ] = {
      "insert":"String value here",
      "update":"String value here",
      "delete":"String value here"
      };


   this.errorMessageArray[ "geoLocation" ] = {
      "insert":"String value here",
      "update":"String value here",
      "delete":"String value here"
      };


   this.setToolBarAUIHelp = function ( var1, var2 ) {

      //set toolBar help message
      return;

     };

   this.setToolBarAUIError = function ( var1, var2) {
       //set toolBar error message
       return;
    };

}

Netbeans给出错误:

setToolBarAUIHelp(var1,var2)undefined

setToolBarAUIError(var1,var2)undefined

1 个答案:

答案 0 :(得分:0)

试试这个:

var farmFile = farmFile || {};
farmFile.toolBarAUIHelp = new toolBarAUIHelp()|| {};

function toolBarAUIHelp(){

   this.helpMessageArray = {};
   this.errorMessageArray = {};

   this.helpMessageArray[ "geoLocationTitle" ] = {
      "insert":"String value here",
      "update":"String value here",
      "delete":"String value here"
      };


   this.errorMessageArray[ "geoLocation" ] = {
      "insert":"String value here",
      "update":"String value here",
      "delete":"String value here"
      };


   this.setToolBarAUIHelp = function ( var1, var2 ) {

      //set toolBar help message
      return;

     };

   this.setToolBarAUIError = function ( var1, var2) {
       //set toolBar error message
       return;
    };

}