Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!