您的位置:首页 > Web前端 > JavaScript

Extjs 简单扩展 Component 实现点击刷新的验证码。

2009-03-05 00:42 405 查看
Ext.Image=Ext.extend(Ext.Component,{
initComponent:function()
{

},
onRender:function(ct, position)
{
var a= document.createElement('A');
a.id = this.id;a.href="javascript:void(0)";
var el = document.createElement('IMG');
el.src=this.src+'?'+Math.random();
a.appendChild(el);
this.el = Ext.get(ct.dom.appendChild(a));
if(this.autoRefresh)
this.el.on('click', this.onClick, this);
},
onClick: function(e){
this.el.first().dom.src=this.src+'?'+Math.random();
}
})
Ext.reg('ximg',Ext.Image);


 

以下是json
{
xtype:'ximg',
src:'http://www.java125.cn/common/getcode.asp',
autoRefresh:true
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息