// @private
onRender: function() {
var me = this,
addOnclick,
btn,
btnListeners
me.doc = Ext.getDoc()
me.callParent(arguments)
// Set btn as a local variable for easy access
//这里是指向了一个dom
btn = me.el
if (me.tooltip) {
me.setTooltip(me.tooltip, true)
}
// Add the mouse events to the button
if (me.handleMouseEvents) {
btnListeners = {
scope: me,
mouseover: me.onMouseOver,
mouseout: me.onMouseOut,
mousedown: me.onMouseDown
}
if (me.split) {
btnListeners.mousemove = me.onMouseMove
}
} else {
btnListeners = {
scope: me
}
}
// Check if the button has a menu
if (me.menu) {
me.mon(me.menu, {
scope: me,
show: me.onMenuShow,
hide: me.onMenuHide
})
me.keyMap = new Ext.util.KeyMap({
target: me.el,
key: Ext.EventObject.DOWN,
handler: me.onDownKey,
scope: me
})
}
// Check if it is a repeat button
if (me.repeat) {
me.mon(new Ext.util.ClickRepeater(btn, Ext.isObject(me.repeat) ? me.repeat: {}), 'click', me.onRepeatClick, me)
} else {
// If the activation event already has a handler, make a note to add the handler later
if (btnListeners[me.clickEvent]) {
addOnclick = true
} else {
btnListeners[me.clickEvent] = me.onClick
}
}
// Add whatever button listeners we need
//这里将事件加到 btn 上 , 就是那个dom
me.mon(btn, btnListeners)
// If the listeners object had an entry for our clickEvent, add a listener now
//这里同样
if (addOnclick) {
me.mon(btn, me.clickEvent, me.onClick, me)
}
Ext.button.Manager.register(me)
},
你好.在<img>标签内 可以放入onclick事件 该事件必须指定一个作用域链.
如 windows.addOnclick = function(){}
便是 onclick="windows.addOnclick()" 或是 onclick="addOnclick()" 这是windows的作用域
你可以用Ext的命名空间 如 oa.bbq.addOnclick = function(){}
便是 onclick=" oa.bbq.addOnclick()" 也就是说 你现在的js与 这种dom类的事件容易出现作用域问题.
获取css的话 肯定要先获取这个dom dom.style即可
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)