0
function fake()
{
var ffake;
}

fake.prototype.abc = function()
{
   fake.ffake = 1;//not working in IE7 but seems to be working in all others
}

var myNewObject = new fake();  

因为剧本就在那一瞬间被打破,无法前进。

首先我没有得到理由,然后我在谷歌上花了将近 2 个小时来找出解决方案。

任何帮助将不胜感激

4

1 回答 1

3

尝试改变:

fake.ffake = 1;

到:

this.ffake = 1;

例子:

function fake()
{
  var ffake;
}

fake.prototype.abc = function()
{
   this.ffake = 1;
   alert(this.ffake);
}

var myNewObject = new fake();  
myNewObject.abc(); // alerts "1"
于 2012-07-02T06:03:28.603 回答