以下代码发现txt.value 就算是我在模式窗体中改变了图片(上传),但是反回值名称不变。 这种情况img1.src='../picture/article/'+txt.value;竟然不变。还是老样子,像是有缓存。  如果返回文件名变啦,就好啦。有什么办法
var url = linkurl;
    var result =  window.showModalDialog(url,window,'dialogWidth=450px;dialogHeight=400px;scroll=yes;center=yes;status=no');
   
    result=(result==undefined?"请点击上传":result);
    
    if(result=="请点击上传")
    {
        if(txt.value!="请点击上传")
        {
          //不做任何操作
        }
    }
    else
    {
      txt.value=result;
      img1.src='../picture/article/'+txt.value;
      img1.width=120;
      img1.height=92;
    }

解决方案 »

  1.   

    页面地址加上参数
    var result =  window.showModalDialog(url+"&temp=" + Math.round(Math.random() * 10000)",window,'dialogWidth=450px;dialogHeight=400px;scroll=yes;center=yes;status=no'); 
      

  2.   

    把问题要描述清楚,你的问题到底是怎么用一个东西。如果模态窗口修改了数据,你要在模态窗口用js来改变父窗口的对象,那你就要用父窗口对象,或者opener对象或者top对象来改变。然后把txt.value  alert一下,看看,到底是什么值,为什么没变,是没有用全局变量或者是变量引用错误,不然你就把代码贴全,这样没法看
      

  3.   

    我指的不变是指图片样子已在模式窗体中重新上传,也反回了值。都正常。只是我反回的还是老文件名。这时使用 img1.src='../picture/article/'+txt.value; 图片还是老图片,虽然我已经重新上传啦(替掉原来的)。
      

  4.   

    你关闭模态窗口的时候alert一下图片路径,怎么可能会永远同一个,肯定你的写法有问题了,你模态窗口的js是怎么写的
      

  5.   

    img1.src='../picture/article/'+txt.value +"?r="+ Math.round(Math.random() * 10000)