-
方式一:
<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都会被调用,调用顺序是看谁在前面.