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

110
Views
Change an image during a month

I want a certain logo to show up during a month. I tried the following but it never worked. One is a gif and the other is a PNG.

Javascript:

var logo = document.getElementById("logo");

const refreshStatus = () => {
  // Get dates/time/hours
  let today = new Date(); //today date

  //Show available if this matches
  if (today.getMonth == 5) {
    logo.src='../../img/logo2.gif';
  } else {
    logo.src='../../img/logo.png';
  }
}

// run when starting
refreshStatus();

// updates every 8 seconds
setInterval(refreshStatus, 8000);

HTML:

<a href="../index.html" class="index-link"><img src="../img/logo.png" alt="Logo" class="logo" id="logo"></a>
<script src="js/pride.js"></script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to call getMonth for it is a function (or more specifically a method on Date.prototype). Currently you are comparing a function to a number, which is never true.

if (today.getMonth() == 5) { // ...
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!