代码如下,功能很简单,就是显示指定url的图片,在firefox下是正常的,一到ie8下就报错,
错误出在Ext.getCmp('img_viewer_box').getEl().dom.src = imgurl;这一句上,各位有什么好的结局方案?var imageWin;
///显示指定url的图片
function ShowImg(imgurl,imgtitle)
{
//Ext.Msg.alert('Status',imgurl);
if(!imageWin)
{
imageWin = new Ext.Window({
title: imgtitle+' - '+imgurl,
src: imgurl,
height:400,
width:536,
//bodyStyle:'background-image:url('+imgurl+');background-repeat:no-repeat; background-attachment:scroll;',
plain:false,
maxinizable:true,
closeAction:'hide',//"close"释放窗体所占内存,"hide"隐藏窗体
closable:true,
autoDestroy:true,
layout:'fit',
items:[{
xtype: 'box', //或xtype: 'component',
id:'img_viewer_box',
autoEl: 
{
tag: 'img',    //指定为img标签
src: imgurl    //指定url路径
}
}]
});
}
else
{
Ext.getCmp('img_viewer_box').getEl().dom.src = imgurl;
imageWin.setTitle(imgtitle+' - '+imgurl);
}
if(imageWin.isHidden())
{
imageWin.show();
}
}

解决方案 »

  1.   


    用这种方式如何:
    imageWin.get(0).update('<img border=0 src="'+imgurl+'">');
      

  2.   

    IE8提示:网页错误详细信息消息: 该操作的目标元件无效。
    行: 6452
    字符: 21
    代码: 0
    URI: extjs4/ext-all-debug.js
      

  3.   

    firefoximageWin.get is not a function
      

  4.   

    不知道楼主是如何使用的,我这里测试过IE8没问题。。
    又或者说是你自己哪里没有把现象说出来吧if(imageWin.isHidden())
        {
            imageWin.show();
        }看看楼主的代码应该是extjs3吧,好像没有isHidden()这个函数的吧
      

  5.   

    EXTJS4没有get函数,改成这样吧:
    imageWin.items.itemAt(0).update('<img border=0 src="'+imgurl+'">');