Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
Dynamic image change according to internal variable

I have 2 images with different names run0.png and run1.png this phrase (:="start_main_m":) which comes after "run" is an internal variable and changes automatically between 1 and 0 from inside the codethus gives the names run1 and run0.

<img border="0" src="pics/run:="start_main_m":.png" width="32" height="32">

With a simple code in HTML, this image changes but only after refreshing the page. I want to change between these 2 images without refreshing the page. I have tried using if condition and setinterval() function but it doesn't change anything and still needs to be refreshed to change the image. It seems like I need to use a kind of for loop condition but don't know how?!?!

function changepic() {
    if (:="start_main_m":==1) {
        document.getElementById("AM").src = "pics/run1.png"
    } else {
        document.getElementById("AM").src = "pics/run0.png"
    }
}

setInterval("changepic()", 500);
<img id="AM" border="0" src="pics/switch0.png" width="105" height="80">

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda