human.prototype.scl=function(){ 
  this.accr=this.name+this.sex+this.age; 
  alert(this.accr); 

解决方案 »

  1.   

    var human=function(name,sex){ 
      this.name=name; 
      this.sex=sex; 

    human.prototype.run=function(){ 
      alert("come on man!!"); 

    human.prototype.age=13; 
    human.prototype.scl=function(){ 
      this.accr=this.name+this.sex+this.age; 
      alert(this.accr); 

    var object=new human('guo','sex') 
    object.scl(); 
      

  2.   


            function Human(){}
    Human.prototype.name = "";
    Human.prototype.sex = "";
    Human.prototype.run = function(){
    alert("come on man!");
    }

    function Object(){}
    Object.prototype.name = "guo";
    Object.prototype.sex = "M";
    Object.prototype.scl = function(){
    var accr = Object.prototype.name + Object.prototype.sex;
    alert(accr);
    } var me = new Object();
    me.scl();比较标准的prototype写法..
      

  3.   

    作用域的问题,
    运行到human.prototype.scl=function(){ 的时候没找到name,sex,age
    因为name,sex,age即没有在方法内部声明(var name = 'name'),也没有使用全局变量(this.name),所以就出错了