为什么它不让我使用窗口打开,我做错了什么?

时间:2014-09-20 11:26:24

标签: javascript export

 function Human(name,currentMail,currentScore,newScore){
 this.name=name || document.querySelectorAll('#e1').value || "Enter Name";
 this.currentMail= currentMail || document.querySelectorAll('#e2').value ||
  "Enter Email";
 this.currentScore=currentScore || document.querySelectorAll('#e3').value || 
 "Enter    Score";
   this.changeScore = function(ns){
                        if (ns!=""){
                        console.log(ns+" Is Your New  Score");
                        this.currentScore=ns;}
                        };

 this.changeMail = function(cmail){
                        if(cmail!=""){
                        console.log(cmail + " Is Your New Mail");
                        this.currentMail = cmail};
                        };
 this.Xport = function(){
                        var exporte=
                        window.open("", "MsgWindow", "width=200, height=100");
                        exporte.document.writeln("<p>"+ this.name +
                        " "+this.currentMail+
                        " " + this.currentScore "</p>");
                        };                          
  };
 var ilan = new Human();
 ilan.name= "ilan Vachtel";
 ilan.currentMail = "ilanvac@gmail.com";
 ilan.currentScore = "95";
 ilan.newScore = "89";
 ilan.changeScore("89");
 console.log(ilan.currentScore);
 ilan.changeMail("ilanvac@013.net");
 console.log(ilan.currentMail);
 var haim = new Human();
 haim.name = "Haimon";
 haim.currentMail="ilanvac@013.net";
 haim.currentScore="54";
 console.log(haim);
 haim.changeScore("77");
 haim.changeMail("haimvac@gmail.com");
 haim.Xport();

这是JavaScript中的一个Obect Oriented文件,尝试将一些窗口中的一些东西导出到另一个窗口之后 从输入值中收集它们在表单或手动输入中,我总是得到“Xport函数中的语法错误,它无效,我做错了什么?”

2 个答案:

答案 0 :(得分:0)

您在+之前错过了this.name

this.Xport = function(){
                        var exporte=
                        window.open("", "MsgWindow", "width=200, height=100");
                        exporte.document.writeln("<p>" this.name +" "+this.currentMail+
// Here -----------------------------------------------^
                        " " + This.currentScore "</p>");
                        };                          
};

答案 1 :(得分:0)

This.currentScore更改为this.currentScore,不要错过字符串concat中的+