不刷新页面,如何强制图片刷新?

dobly 2005-08-04 04:45:29
如题。

我试过,这种做法不刷新图片,而是从缓存中取:
img1.src=图片地址;

...全文
1065 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
luluxiang 2005-09-26
  • 打赏
  • 举报
回复
不抱错了,但是怎么还是不行啊??只有一次的效果

<!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>


我想要的是不停的有图像变化的效果!谢谢了!
javalin3012 2005-09-26
  • 打赏
  • 举报
回复
img1.src=img1.src + "?" + (new Date().getTime())
这个我试了,还是不能保证100%的刷新。

img1.src=图片地址;
我也是用这个方法实现更换图片的,但是有时候可以更换有时候不行,这怎么回事?

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

deiphi 2005-09-26
  • 打赏
  • 举报
回复
mark
matrixy 2005-09-26
  • 打赏
  • 举报
回复
img1.src=img1.src + "?" + (new Date().getTime())
luluxiang 2005-09-25
  • 打赏
  • 举报
回复
怎么老是抱错啊??错误:缺少 ';'
rayFairy 2005-08-04
  • 打赏
  • 举报
回复
试试看把
lingyu 2005-08-04
  • 打赏
  • 举报
回复
var date=new Date();
img1.src=图片地址+"?"+date.toLocaleString();
只要保证每次src的字符串不同就会重取,但图片是连?前的地址

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧