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

225
Views
JavaScript change div's URL with multiple img's src when using onmouseover img's, using 'this' key, and function

I have one div with id='image' and background-image url, and I have 3 images with different src's- src='/some.jpg' and onmouseover='someFunction(this)'

I want when I put my mouse on one image to change div image to image that I put my mouse on.

I will leave function empty, I know I need to do document.getElementById ('image') and I tried a lot, with style.background-image and with variable, but obviously I'm doing something wrong

This is just one of many codes that I tried-

     <div id="image"> display here</div>
    
        <img
          class="preview"
          src="/img/tee1.jpg"
          alt="teaTime"
          onmouseover="upDate(this)"
          
        />
<img
          class="preview"
          src="/img/tee2.jpg"
          alt="teaTime2"
          onmouseover="upDate(this)"
          
        />
<img
          class="preview"
          src="/img/tee3.jpg"
          alt="teaTime3"
          onmouseover="upDate(this)"
          
        />
    #image {
      background-image: url("/img/tee3.jpg");
      background-color: bisque;
      width: 300px;
      height: 300px;
      border: 5px solid black;
     }
    function upDate(element) {
    
    
    }
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!