简体   繁体   English

我的Javascript类上的Netbeans 7.3.1自动完成代码不起作用

[英]Netbeans 7.3.1 autocomplete code on my Javascript Class doesn't work

I have a question about autocomplete code for Javascript on Netbeans 7.3.1 for Mac. 我有一个关于Mac上Netbeans 7.3.1上Javascript的自动完成代码的问题。 I have the following javascript code tha defines a class "Person": 我有以下javascript代码,它们定义了一个类“ Person”:

function Person(nm, cgn, ss){
                 this.nome = nm;
                 this.cognome = cgn;
                 this.sesso = ss;

                 this.getNome = function(){
                    return nome;
                 };
                 this.getCognome = function(){
                    return cognome;
                 };
                 this.getSesso = function(){
                    return sesso;
                 };
              }

Under this code, if i try to write the following code: 在此代码下,如果我尝试编写以下代码:

var aPerson = new Person("C", "A", "p");
aPerson.get

I don't see (in autocomplete box) any function related to Person object. 我没有看到(在自动完成框中)与Person对象相关的任何功能。

Thanks. 谢谢。

It's a limitation of NetBeans. 这是NetBeans的局限性。 Follow this step 遵循这个步骤

  1. Create a new file .js : MyClass.js 创建一个新文件.js: MyClass.js
  2. Insert class declaration in MyClass.js MyClass.js插入类声明
  3. Back to the .html and import the file <script src = "MyClass.js"> 返回.html并导入文件<script src = "MyClass.js">

Now you can use the object MyClass with autocompletion. 现在,您可以使用具有自动补全功能的MyClass对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM