Ext.onReady(function(){
var _window = new Ext.Window({
title:"测试窗体",
layout:"form",
width:260,
labelWidth:45,
plain:true,
//容器生成文本框
items:[{
xtype:"textfield",
width:180,
fieldLabel:"姓名"
},{
xtype:"textfield",
width:180,
fieldLabel:"密码"
}],
buttons:[{
text:"确定",
//句柄函数的this是指向button
handler:function(){
//ownerCt当前容器对象
//容器对象的集合,
var collection = this.ownerCt.items;
//first(),就是这个文本框
alert(collection.first().getValue());
alert(collection.itemAt(1).getValue());
}
}]
});
_window.show();
})ExtJS学习笔记六:按钮获取window中的文本域
最新推荐文章于 2019-01-10 11:04:30 发布
本文介绍了一个使用ExtJS框架创建简单窗口和表单的示例代码。该示例展示了如何设置窗口属性,如标题和尺寸,并通过布局管理器组织内部元素。此外,还演示了如何添加文本输入框及按钮,并实现按钮点击事件来获取输入框的值。

2479

被折叠的 条评论
为什么被折叠?



