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

151
Views
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
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!