var variable = "变量值";test.prototype.hh = variable;

解决方案 »

  1.   

    var Class = {
      create: function() {
        return function() {
          this.initialize.apply(this, arguments);
        }
      }
    }var test = Class.create();
    test.prototype = {
      initialize: function() {
        this.aa = 11;
      },
      
      hh: function() {
      }
    }
      

  2.   

    function ClassA(){}
    ClassA.prototype.color = "red";
    ClassA.prototype.show = function(){alert(this.color);};
      

  3.   

    function ClassA(col){
    this.color = col;
    }
    ClassA.prototype.show = function(){alert(this.color);};
      

  4.   

    多谢各位的答复!可能是我没描述清楚......
    test.prototype.hh=function(){......}
    我的意思是上面的hh值是一个变量,我的意思是'hh'本身是一个不确定的值!!
    多谢各位大虾再赐教!!!!!
      

  5.   

    eval("test.prototype."+hh+"=function(){......}");