摘要:
view plaincopy to clipboardprint?<mce:script type="text/javascript"><!-- var A = function() { this.initialize.apply(this , arguments); //这里apply调用的是prototype中的initialize为什么不调用这个initialize而死循环呢? }; A.prototype= { initialize:function(v){this.value=v;}, showValue:function(){alert(thi 阅读全文
摘要:
Javascript中function即为类,在function内部用this设置类的public成员变量与方法,例如:view plaincopy to clipboardprint?function myclass(name){ var str = "private string"; //private field function privatefn(){ //private method alert(str); }; this.name = name; this.pubfn = function(){ privatefn(); //call private meth 阅读全文