日期:2014-05-16 浏览次数:20387 次
function A()
function A()
{
var _a = "";
A.prototype.getA = function(){return _a;};
A.prototype.setA = function(a){_a = a;};
}
var a1 = new A();
var a2 = new A();
a1.setA("1");
a2.setA("2");
alert(a1.getA()); // 输出2
alert(a2.getA()); // 输出2
function A()
function A()
{
var _a = "";
this.getA = function(){return _a;};
this.setA = function(a){_a = a;};
}
var a1 = new A();
var a2 = new A();
a1.setA("1");
a2.setA("2");
alert(a1.getA()); // 输出1
alert(a2.getA()); // 输出2
function A()
function A()
{
_a = "";
this.getA = function(){return _a;};
this.setA = function(a){_a = a;};
}
var a1 = new A();
var a2 = new A();
a1.setA("1");
a2.setA("2");
alert(a1.getA()); // 输出2
alert(a2.getA()); // 输出2