iGuest 3 Report post Posted October 10, 2011 Just to tidy up kshan's code <img src="image_name.jpg" width="275" height="200" border="1" name="refresh"> <script language="JavaScript" type="text/javascript"> <!-- var t = 120 // interval in seconds function Start() { document.images["refresh"].src = document.images["refresh"].src+"?"+Math.random() setTimeout("Start()", t*1000) } Start(); // --> </script> Hello there,I tried using the above code to refresh an image in my webpage. It does not work. It loads the image only once and stays put. Am I doing something wrong? Could someone kindly help me?Thanks.<!DOCTYPE html><%@ page import="java.util.*" %><%@ page import="java.util.Calendar" %><%@ page import="java.io.File" %><%@ page import="java.io.*" %><%@ page language="java" import="java.util.*"%> <HTML><head> </head> <BODY><img src="C:\\WebDev\\uploads\\image\\image.jpg" border="1" name="track"><script language="JavaScript" type="text/javascript">function refreshImage(){ image = "C:\\WebDev\\uploads\\image\\image.jpg" document.images["track"].src = image; System.out.println("Cycle\n"); setTimeout("refreshImage()", 5000);}refreshImage();</script></BODY></HTML> Share this post Link to post Share on other sites