Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda