摘要: 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 阅读全文
posted @ 2011-03-07 10:12 awp110 阅读(374) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2011-03-07 09:58 awp110 阅读(208) 评论(0) 推荐(0) 编辑