Question : javscript to show images after every second

hi,
i am trying to do a simple html page to show images after every second to the image tag.
its not working ok
please can some  look into the attached and advise
thanks
c
pls rename from .txt to .rar
Attachments:
 
 

Answer : javscript to show images after every second

I changed the code a bit, you used getElementById(), but the element did not have any ID.
This code works fine:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
<html>
<head>
<title>
Test Images
</title>
</head>
<script type="text/javascript">
var image1 = new Image();
image1.src = "purple.gif";
var image2 = new Image();
image2.src = "red.gif";
var image3 = new Image();
image3.src = "blue.gif";
var image4 = new Image();
image4.src = "yellow.gif";
var image5 = new Image();
image5.src = "green.gif";
var image6 = new Image();
image6.src = "pink.gif";
window.onload=randomimageid();
function check()
	{
	var img_name = new Array("purple.gif", "red.gif", "blue.gif", "yellow.gif", "green.gif", "pink.gif");
	var l = img_name.length;
	var rnd_no = Math.floor(l*Math.random());
	document.r_img.src = img_name[rnd_no];
	}

function randomimageid()
       { 
	var img_name = new Array("purple.gif", "red.gif", "blue.gif", "yellow.gif", "green.gif", "pink.gif");
	var l = img_name.length;
	var rnd_no = Math.floor(l*Math.random());
 
	document.getElementById("randomimage").src = img_name[rnd_no];
	setTimeout("randomimageid()",1000);
	}
</script>
<body onLoad="randomimageid();">
<h2> test images</h2>
<img src="purple.gif" width="100" height="50" 
name="randomimage" id="randomimage" alt="Random image" />
</body>
</html>
Random Solutions  
 
programming4us programming4us