view plaincopy to clipboardprint?
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);
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
view plaincopy to clipboardprint?
{
xtype:'ximg',
src:'http://www.java125.cn/common/getcode.asp',
autoRefresh:true
}
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);
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
view plaincopy to clipboardprint?
{
xtype:'ximg',
src:'http://www.java125.cn/common/getcode.asp',
autoRefresh:true
}
本文介绍了一种使用ExtJS框架创建自刷新图片组件的方法。该组件能够通过点击自动更新图片资源,确保显示最新的图像内容。文章详细展示了如何利用Ext.Component进行扩展来实现这一功能,并提供了具体的JavaScript代码实现。
3597

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



