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

135
Views
Problen with replace style.backgroundImage and array

Hi i'm a beginer in javascript, i'm trying to change background Imgage css style but i have this error: Failed to load resource: the server responded with a status of 404 (Not Found).

 <div id="slide"></div>

css

#slide{
     background-repeat: no-repeat;
    background-size: 93%;
    position: absolute;
    right: 1%;
    top:25%;
    height: 70%;
    width: 44%;
    overflow: hidden;
}

JC

var i = 0;      
var images=[];
var slide = document.getElementById("slide");
var time = 3000;
     
images[0] = '../image/1.jpg';
images[1] = '../image/2.jpg';
images[2] = '../image/3.jpg';
images[3] = '../image/4.jpg';
images[4] = '../image/5.jpg';
images[5] = '../image/6.jpg';
images[6] = '../image/7.jpg';

function changeImg(){
    slide.style.backgroundImage = "url('images[i]')";

    if(i < images.length - 1){
    
      i++; 
    } else { 
    
        i = 0;
    }


    setTimeout("changeImg()", time);
}

window.onload=changeImg;
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!