欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

学习ExtJS(二) Button常用方法

程序员文章站 2023-12-29 15:25:10
一、属性 renderto:将当前对象所生成的html对象存放在指定的对象中 text:得到按钮名称 minwidth:按钮最小宽度 hidden:按钮的隐藏或显示(tru...
一、属性
renderto:将当前对象所生成的html对象存放在指定的对象中
text:得到按钮名称
minwidth:按钮最小宽度
hidden:按钮的隐藏或显示(true or false)
二、构造参数
handler:指定一个函数句柄,在默认事件触发时调用,此时在默认事件为click
listeners:在对象初始化之前,将一系列事件进行绑定。
三、函数
getbogy():对到body对象
onready():当页面加载完成时执行本函数
gettext():得到按钮名称
settext("按钮名称"):设置按钮名称
四、应用举例
复制代码 代码如下:

ext.onready(function(){
var button= new ext.button({
renderto:ext.getbody(),
text:"确定",
listeners:{
"click":function()
{
alert("hello");
}
}
})
button.minwidth=200;
button.settext("easypass");
})

复制代码 代码如下:

ext.onready(function(){
var button= new ext.button({
renderto:ext.getbody(),
text:"确定"
})
button.on("click",function(){
alert("hello");
})
button.minwidth=200;
button.settext("easypass");
})

上一篇:

下一篇: