Traffic Light

offsite

#1

The below code is about traffic light, when yo click next the next traffic light come step my step (First red than red and amber, than green and last one is again amber )
This code work but can anyone please tell me how to change this code or add a code to this code make traffic light the traffic light automatically, like you don't have to click on the next button.
After every 1 second the traffic light will changes by it's on self.
please help me.
Answer me please ASAP

<html>
<head>
<title>JavaScript Rollover 1</title>
<script>
	imgArray = new Array (4);
    imgArray[0] = new Image;
	imgArray[0].src = "Red light.jpg";
	imgArray[1] = new Image;
	imgArray[1].src = "Red,Amber light.jpg";
	imgArray[2] = new Image;
	imgArray[2].src = "Green light.jpg";
	imgArray[3] = new Image;
	imgArray[3].src = "Amber light.jpg";
	index = 0;

    function doBack()
    {
        if(index > 0)
        {
		    index--;
		    document.slideshow.src=imgArray[index].src;
	    }
	    return;
    }
	
	function doNext()
	{
	if(index < 3)
	{
		index++;
		document.slideshow.src=imgArray[index].src;
	}
    return;
}
</script>
</head>

<body>
    
<center>
<img src="Red light.jpg" name="slideshow" 
    width=200 height=400>
<p><h3 align="center"><a href=javascript:doBack()>Back</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href=javascript:doNext()>Next</a></h3>
</center>


</body>
</html>

#2

Please post a link to the exercise. Thank you.

Edit. Never mind. It is not one of CC's exercises.

https://www.google.ca/search?q=function+doBack()