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

117
Visualizações
Siemens webserver Image change using JavaScript in html

Im trying to dynamically change a picture in html page according to a true/false condition using javascript. If the variable is 0 an image and if it was 1 another picture should be shown in html page.

There are many pictures in a project that need to be changed i need a function that can do this application. But i dont know if it can be done with a single function or i should use a function for each variable.

Is siemens webserver the variable change is applied automatically by typing :="X": when x is 0 instead of :="X": the number 0 is replaced and for the 1 instead of :="X": the number 1 is replaced. Im familiar with html coding and how to change the picture using the image name and adding 0 or 1 after image name. For example i name a picture stop0.png and another picture stop1.png . now in the html code i type stop:="X":.png in this way picture changes according to variable x But this method needs the page to be refreshed to show the change. I want to do this in the easiest way possible without page refresh.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

hmi should be designed in one page (for example named test.htm) and another html page with following code would update every thing in "test.htm" every second.

<!DOCTYPE html>
<html>
<body>

<div id="demo">
  <h2>auto update page</h2>
</div>
<script>
function loadDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
     document.getElementById("demo").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "test.htm", true);
  xhttp.send();
}
setInterval("loadDoc()", 1000);
</script>
</body>
</html>

about 4 years ago · Juan Pablo Isaza Relatório
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