javascript image loop not working -


I do not know what to do because I'm going to Java, as I have just started learning, so please Get it / P>

I think I have to increase it when this gap is over, but I do not know how to do it and I do not want to do any jquery.

  & lt; Html & gt; & Lt; Top & gt; & Lt; Style type = "text / css" & gt; Div {height: 300px; Width: 500px; Margin: 0 auto; Hidden flurry; } & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div & gt; & Lt; Img id = "image" src = "html.png" alt = "html" & gt; & Lt; / Div & gt; & Lt; Script language = "javascript" type = "text / javascript" & gt; Var i = 1; Function loop () {var i = i + 1; If (i == 3) {i = 1; } If (I == 1) {document.getElementById ('image') src = "html.png"; } And {document.getElementById ('image'). Src = "css3.png"; }} Var pictureloop = setInterval (loop (), 5000); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

You just have to try:

Just set the variable In i , you do not need to re-announce after the loop () is declared worldwide! And () remove

  var i = 1; Function loop () {i = i + 1; // Change Warning (i); If (i == 3) {i = 1; } If (I == 1) {document.getElementById ('image') src = "html.png"; } And {document.getElementById ('image'). Src = "css3.png"; }} SetInterval (Loop, 5000); // Change  


Comments