js中的问题(this)(遍历对象中的属性)
for (var i in this)
{
if (this[i] == null) this[i] = "";//属性如果为null,则默认为"";
}
this.i
this.后面只能用常量,除非用eval();
如 eval("this."+i)
不过还是推荐用this[i]
for (var i in this)
{
if (this[i] == null) this[i] = "";//属性如果为null,则默认为"";
}
this.i
this.后面只能用常量,除非用eval();
如 eval("this."+i)
不过还是推荐用this[i]