关于Ext.onReady的三种调用方法

来源:互联网 发布:js代码dos 编辑:程序博客网 时间:2024/05/01 13:41

方式一:
          <script>

           Ext.onReady(function(){

           alert('onready');

 

       });

 

    </script>     

              最简单了,最平常的调用,不用多说

 

方式二:
    <script>

 

       Ext.color = function(){

           return {

              init:function(){

                  alert("init")

              }

           }

       }();

       Ext.onReady(Ext.color.init,Ext.color);

    </script>


 

                   通过onReady调用color函数,init为color中的内置,作用是初始化.这种写法比较实用

 


方式三:
 

    <script>

       Ext.onReady(function(){

      

           alert('onready');

 

       });

       Ext.color = function(){

           return {

              init:function(){

                  alert("init")

              }

           }

       }();

       Ext.onReady(Ext.color.init,Ext.color);

    </script>

 

 


       这种是混合型写法,两个onReady都会被调用,调用顺序是看谁在前面.

文章出处:http://www.diybl.com/course/3_program/java/javaxl/20081010/149693.html

原创粉丝点击