var date=new Date();
img1.src=图片地址+"?"+date.toLocaleString();
只要保证每次src的字符串不同就会重取,但图片是连?前的地址

解决方案 »

  1.   

    img1.src=img1.src + "?" + (new Date().getTime())
      

  2.   

    img1.src=img1.src + "?" + (new Date().getTime())
    这个我试了,还是不能保证100%的刷新。img1.src=图片地址;
    我也是用这个方法实现更换图片的,但是有时候可以更换有时候不行,这怎么回事?图片地址我用过以.开头的本服务器地址,也用过HTTP开头的地址,虽然都可以但是都不能保证100%的更换刷新,用了上面的img1.src=img1.src + "?" + (new Date().getTime())还是不行。如何实现?哪位有解决方法我百分相送!。
      

  3.   

    不抱错了,但是怎么还是不行啊??只有一次的效果<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head>
    <script language="javascript">
    var date=new Date();
    img.src=img/20050413_1_8.jpg + "img/20050413_1_7.jpg" + (new Date().getTime());
    //img1.src=img/20050413_1_8.jpg+"img/20050413_1_8.jpg"+date.toLocaleString();
    </script><body onload="onload()"><SCRIPT>
    <!--
    transeffect = 0;
    theeffects = new Array(10);
    theeffects[0] = "盒状收缩";
    theeffects[1] = "盒状向外";
    theeffects[2] = "圆形收缩";
    theeffects[3] = "圆形向内";
    theeffects[4] = "从下向上";
    theeffects[5] = "从上向下";
    theeffects[6] = "从左向右";
    theeffects[7] = "从右向左";
    theeffects[8] = "百页窗形向右";
    theeffects[9] = "百页窗形向下";
    theeffects[10] = "棋盘形交叉向右";
    theeffects[11] = "棋盘形交叉向下";
    theeffects[12] = "随意溶解形";
    theeffects[13] = "左右向内";
    theeffects[14] = "左右向外";
    theeffects[15] = "上下向内";
    theeffects[16] = "上下向外";
    theeffects[17] = "条纹状向左下";
    theeffects[18] = "条纹状向左上";
    theeffects[19] = "条纹状向右下";
    theeffects[20] = "条纹状向右上";
    theeffects[21] = "溶解水平状";
    theeffects[22] = "溶解上下状";
    theeffects[23] = "随着溶解";current_image = "image1";
    function onload()
    {
    var img = document.all["image1"];
    img.filters[0].Apply();
    img.filters[0].Transition = Math.floor(Math.random() * 24);
    img.filters[0].Play(2.0);
    img.style.visibility='visible';
    }
    //--></SCRIPT>
    <DIV id=image>
    <DIV id=text1></DIV>
      <table width="135" height="180" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top" background="img/20050413_1_1.jpg"><IMG 
    src="img/20050413_1_4.jpg" width="135" height="180" id=image1 
    style="FILTER: revealTrans(Duration=3.0,Transition=1); VISIBILITY: hidden"></td>
        </tr>
      </table>
    </DIV>
    </body>
    </html>
    我想要的是不停的有图像变化的效果!谢谢了!