WEATHER APP background img code doesn't work

i want to change the background due to the temp,but it didn’t work.
this is the code

function changeBackgroundImage(){
  var fah=document.getElementById("temp").innerHTML;
  fah = parseInt(fah);
  if(fah > -10 && fah <= 0){
   document.body.style.backgroundImage='url(img/rain.jpg)';
  }else if(fah > 1 && fah <= 15){
   document.body.style.backgroundImage="url(img/rain.jpg)";
  }else if(fah > 16 && fah <= 30){
   document.body.style.backgroundImage="url(img/sun.jpg)";
  }else if(fah > 31){
   document.body.style.backgroundImage="url('https://images.pexels.com/photos/66997/pexels-photo-66997.jpeg?auto=compress&cs=tinysrgb&h=350')";
  };
 
}

Thank you very much for your help.this is the code pen https://codepen.io/monaalzant/pen/KoYpyY
the app works fine in chrom but it doesnt work in the codepen ,
thank you