line2="<b>address:</b>"+this.addree+"<br>\n";
  line3="<b>phone:</b>"+this.phone+"<br>\n";
  line4="<b>email:</b>"+this.email+"<hr>\n";

解决方案 »

  1.   

    <head>
    <title>构造函数例子</title>
    <script language="javascript">
    function PrintCard()  

    //错误0:函数名字不一致PrintCard
      line1="<b>name:</b>"+this.name+"<br>\n";
      line2="<b>address:</b>"+this.address+"<br>\n"; //错误1:少",address没有写对
      line3="<b>phone:</b>"+this.phone+"<br>\n";//错误2:少"
      line4="<b>email:</b>"+this.email+"<hr>\n";//错误3:少"
    document.write(line1+line2+line3+line4);//错误4:用了,
    }
    function Card(name,address,phone,email)
    { this.name=name;
      this.address=address;
      this.phone=phone;
      this.email=email;
      this.PrintCard=PrintCard;//原来这里错
    }</script>    
    </head>
    <body>
    <h1 aling="center">javascript example test</h1>
    <p>javascript begin!</p><hr>
    <script language="javascript">
    a=new Card("庆胜","江苏","1396113797","[email protected]");
    b=new Card("李四","河南","13861173856","[email protected]");
    c=new Card("张三","上海","13625578945","[email protected]");
    a.PrintCard();//这3行也错
    b.PrintCard();
    c.PrintCard();
    </script>
    end of script! 
    </body> 
    </html> 
      

  2.   

    我改了一下谢谢你的问题!
    <html>
    <head>
    <title>构造函数例子</title>
    <script language="javascript">
      function PrintCard(){ 
        line1="<b>name:</b>"+this.name+"<br>\n";
        line2="<b>address:</b>"+this.addree+"<br>\n";
        line3="<b>phone:</b>"+this.phone+"<br>\n";
        line4="<b>email:</b>"+this.email+"<hr>\n";
        document.write(line1,line2,line3,line4);  
      } 
      function Card(name,address,phone,email){ 
        this.name=name;
        this.address=address;
        this.phone=phone;
        this.email=email;
        this.PrintCard=PrintCard;
      }</script>    
    </head>
    <body>
    <h1 aling="center">javascript example test</h1>
    <p>javascript begin!</p><hr>
    <script language="javascript">
    a=new Card("庆胜","江苏","1396113797","[email protected]");
    b=new Card("李四","河南","13861173856","[email protected]");
    c=new Card("张三","上海","13625578945","[email protected]");a.PrintCard();
    b.PrintCard();
    c.PrintCard();
    </script>
    end of script! 
    </body> 
    </html> 
      

  3.   

    line2="<b>address:</b>"+this.addree+"<br>\n";
    ==>line2="<b>address:</b>"+this.address+"<br>\n";
    老兄拼写错误多了点阿
      

  4.   

    还有这里<h1 aling="center">javascript example test</h1>
    改为align="center"