zoukankan      html  css  js  c++  java
  • javascript 谁才是initialize方法

    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(this.value);}  
        }  
     
        var a = new A('helloWord!');//实例化一个A的对象a  
          
        a.showValue("helloWorld");  
    // --></mce:script> 
    <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(this.value);}
     }

     var a = new A('helloWord!');//实例化一个A的对象a
     
     a.showValue("helloWorld");
    // --></mce:script>

    view plaincopy to clipboardprint?
     <mce:script type="text/javascript"><!--  
    var A = function()   
            {  
                alert("here is befor this.initialize~!");  
                this.initialize.apply(this , arguments);  
                //这里只是指明委派给谁,并不是调用。  
                alert("here is after this.initialize~!");  
            };   
    A.prototype=  
    {  
        initialize:function(v){this.value=v;alert("here is prototype.initialize~! and the value is :"+this.value);},  
        showValue:function(){alert(this.value);}  
    }  
    var a = new A('helloWord!');//实例化一个A的对象a  
    a.showValue("helloWorld");  
    / --></mce:script> 

    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/nailwl/archive/2009/07/28/4386591.aspx

  • 相关阅读:
    Ceph性能优化
    查看linux中的TCP连接数
    从 PC 卸载 Office
    VDI数据恢复
    xencenter迁移云主机方法
    深入解析UUID及其应用(转载)
    XenServer master主机的作用
    解决CentOS下可以ping通ip ping不通域名
    利用Powershell查询AD中账号属性
    创建进程的第二种方法,以后很多都用这个方法。
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1973300.html
Copyright © 2011-2022 走看看