-1

私はGoogle Chromeの拡張機能を作成していますが、いくつかの問題があります。フォームとそのアクションを表すオブジェクト ファイルを取得しました。私の問題は、オブジェクトを使用した後、何かが壊れて、スクリプト ファイルのコードが実行されないことです。

フォーム オブジェクト ファイルは次のとおりです。

/// <reference path="../Jquery1.6_vsdoc/ChromeExtenVSdoc.js" />
/// <reference path="../Jquery1.6_vsdoc/jquery-vsdoc.js" />

function FormInputObject() {

this.BusinessName = "";
this.ShortDesc = "";
this.LongDesc = "";
this.Location = "";
this.ContactName = "";
this.Telephone = "";
this.CellPhone = "";
this.FaxNumber = ""
this.Adress = "";
this.City = "";
this.BusinessEmail = "";
this.WebSiteAdress = "";
this.Keywords = "";

this.PrivateName = "";
this.PrivateTelepone = "";
this.PrivateEmail = "";


//get user data from the INPUT html
this.GetInputFormDocument = function (document) {

    this.BusinessName  = $("name");
    this.ShortDesc     = $("descriplittle");
    this.LongDesc      = $("descrip");
    this.Location      = $("area");
    this.ContactName   = $("contactman");
    this.CellPhone     = $("pelephone");
    this.FaxNumber     = $("fax");
    this.Adress        = $("adr");
    this.City          = $("city");
    this.BusinessEmail = $("email");
    this.WebSiteAdress = $("www");
    this.Keywords      = $("keywords");

    this.PrivateName     =  $("firstname1");
    this.PrivateTelepone =  $("phone1");
    this.PrivateEmail    =  $("email1");
}

this.ClearForm = function (document) {


    this.ShortDesc         .text("");
    this.LongDesc          .text("");
    this.Location          .text("");
    this.ContactName       .text("");
    this.CellPhone         .text("");
    this.FaxNumber         .text("");
    this.Adress            .text("");
    this.City              .text("");
    this.BusinessEmail     .text("");
    this.WebSiteAdress     .text("");
    this.Keywords          .text("");

    this.PrivateName       .text("");
    this.PrivateTelepone   .text("");
    this.PrivateEmail      .text("");
}



  //sending only the object fields
   this.sendFormFields = function (command) {
        chrome.extension.sendRequest(null,
            {
                input          : command            ,
                BusinessName   : this.BusinessName  ,
                ShortDesc      : this.ShortDesc     ,
                LongDesc       : this.LongDesc      ,
                Location       : this.Location      ,
                ContactName    : this.ContactName   ,
                CellPhone      : this.CellPhone     ,
                FaxNumber      : this.FaxNumber     ,
                Adress         : this.Adress        ,
                City           : this.City          ,
                BusinessEmail  : this.BusinessEmail ,
                WebSiteAdress  : this.WebSiteAdress ,
                Keywords       : this.Keywords      ,

                PrivateName       : this.PrivateName    ,   
                PrivateTelepone   : this.PrivateTelepone,
                PrivateEmail      : this.PrivateEmail
            },
             function (response) {

             });

   }

    //sending all of the object
   this.sendTheFormObject = function () {
       chrome.extension.sendRequest(null,
           {
               FormInputObject: this
           },
           function (response) {

           });
   }
}

オブジェクトを使用するスクリプト ファイルは次のとおりです。

/// <reference path="../ChromeExtenVSdoc.js" />
/// <reference path="../Jquery1.6_vsdoc/jquery-vsdoc.js" />
/// <reference path="FormInputObject.js" />

//if i comment this line out, there is no problems and the alerts
//i call in the file run fine
var formInput = new FormInputObject();

$(document).ready(function () {


$("#sendData").click(null, function () {

    formInput.GetInputFormDocument(document);

    formInput.sendFormFields("justFillOutFourm");

});

$("#clearForm").click(null, function () {
    formInput.ClearForm(document);
    alert("asdf");

});
alert("asdf");

});

オブジェクトに問題があることは確かですが、それが何であるかわかりません。(私の英語でごめんなさい)

編集:これは、html上のファイルを参照する方法です:

    <head>
    <title></title>
     <script src="../Jquery1.6_vsdoc/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="input_page.js" type="text/javascript"></script>
   </head>
4

1 に答える 1