Currently, as a GCSE computing student, I am working on being able to modify the interval between different images in my code. Here's what I have so far...
<!DOCTYPE html>
<html>
<body>
<h1> Adjusting Traffic Light Changes </h1>
<img src="RED.jpg" id= "traffic" width="155" height="198">
<script>
var myImage = document.getElementById("traffic");
var imageArray = ["RED.jpg", "RED-ORANGE.jpg", "GREEN.jpg", "ORANGE.jpg"];
var imageIndex = 0;
function changeImage()
{
myImage.setAttribute("src",imageArray[imageIndex]);
imageIndex++;
if (imageIndex >= imageArray.length) {
imageIndex = 0;
}
}
setInterval(changeImage,1000);
</script>
</body>
</html>+
If you could incorporate parts of this code while adjusting the intervals, it would be perfect.