解决方案 »
- js中键盘的相关事件问题
- 请问有好的滚动层的方法吗,可以适合很多浏览器的,不会被360的屏蔽掉
- 怎么样才能实现用JS输出JS? (2)
- 在线求助!!急!!!关于indexof
- 怎样禁止对页面上所有的内容的操作?
- ━━━━━━━ WinXP下如何使IE5.0与IE6.0共存呢? ━━━━━━━
- checkbox问题,请各位指教?????
- document.captureEvents(Event.CLICK) 出错??!!
- easyUI datagrid 绑定json数据问题
- codemirror 设置word-warp换行后光标显示及定位问题
- 请问怎么样能够让窗口始终不关闭?
- frame中的滚动条的问题
console.log(ev.target.boxLabel);
});
console.log(radio.boxLabel);
});
anel.items.each(function () { this.on('focus', function () {console.log(this) }); })
<head>
<link rel="stylesheet" type="text/css" href="./ExtJS4/resources/css/ext-all.css" />
<script type="text/javascript" src="./ExtJS4/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var panel = new Ext.Panel({
renderTo : 'panel',
frame : true,
width : 80,
height : 120,
title : 'Radio',
items : [ {
id : 'radio1',
xtype : 'radio',
boxLabel : '选项一',
name : 'radio',
inputValue : '1',
checked : true
}, {
id : 'radio2',
xtype : 'radio',
boxLabel : '选项二',
name : 'radio',
inputValue : '2'
}, {
id : 'radio3',
xtype : 'radio',
boxLabel : '选项三',
name : 'radio',
inputValue : '3'
} ]
});
Ext.select('input[id^=radio]').on('focus', function(radio, e, eOpts) {
console.log(radio.target instanceof Ext.Component);
console.log(radio.target instanceof Ext.dom.Element);
console.log(radio.target instanceof Ext.CompositeElement);
console.log(radio.boxLabel);
});
});
</script>
</head>
<body>
<div id="panel"></div>
</body>
</html>上面大哥说select返回的是Element类型,我查API说的是Ext.CompositeElement类型,但是我上面的例子输出的是
false
false
false
undefined
所以我也弄不清传入监听函数里的是什么类型了
The handler function the event invokes.Parameters
event : Ext.EventObject
The EventObject describing the event.
target : Ext.dom.Element
The Element which was the target of the event. Note that this may be filtered by using the delegate option.
options : Object
The options object from the addListener call.
Ext不怎么用,都是活学活用。。 Ext.select('input[id^=radio]').on('focus', function (event, target, options) {
//event为事件对象
alert(target == this)//target和this为同一个对象,为DOM对象,因为是直接从dom对象生成的Ext对象
});
addListener: function(eventName, handler, scope, opt) {
var els = this.elements,
len = els.length,
i, e; for (i = 0; i < len; i++) {
e = els[i];
if (e) {
Ext.EventManager.on(e, eventName, handler, scope || e, opt);////////////
}
}
return this;
}