3
Well my doubt is relatively simple, I would like to know how would do in Javascript that if a real condition, for example, 2 > 1
instead of the image of img
appeared the image of the code in script.
My code:
if(2>1){ document.getElementById("amarelo5").src = "cores-roleta/amarelo1.png";
}
<img id="amarelo5" src="cores-roleta/amarelo0.png">
That way you did it’s not working?
– Maicon Carraro
Unfortunately not.
– Gonçalo
Which error shows?
– Maicon Carraro
Still showing yellow image
– Gonçalo
Take a look at the browser console, which error shows?
– Maicon Carraro
possible duplicate of How can I make a roulette in Javascript
– Maicon Carraro
Exactly, I had put this question first, but now that I’ve started to reason, I’ll try to make the colors appear in a row until I get that color.
– Gonçalo
Give me the error: http://prntscr.com/7hvwou
– Gonçalo
Click on that one
teste.html:3
which is in the right corner, it will go straight to the line with error and sends a print dnv– Maicon Carraro
Here you are: http://prntscr.com/7hvy1n
– Gonçalo
Although you have not shown the whole screen, can see that you are assigning in
innerHTML
and not in thesrc
, Beyond that mistake I don’t know what else to not see until the end– Maicon Carraro
I tried with src and Inner and both do not work.
– Gonçalo
In this example that is in your question is working normal, it must be some error that has been hidden, give an analysis.
– Maicon Carraro
I tried with src and it didn’t work either. http://prntscr.com/7hvz1r
– Gonçalo