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

175
Visualizações
Insert a picture with its path in Javascript

Here is the image that I would like to use (HTML path - "Marlene.jpg"):

<div class="startpanel panel transition current">

<div class="image" style="background:url('../../Doggo-particular/dist/pictures/Marlene/Marlene.jpg') 50% 50%; background-size:cover;">
  
</div>

This is the javascript code where I need to put the picture:

var possible_results = [
    {
        
        name: "Marlene",
        //THE ANIMALS CHARACTERISTICS BY WHICH ITS MEASURED:
        colourfulness: 10,
        hairiness: 10,
        landiness: 55,
        size: 80,
        carnivore: 0,
        scariness: 40,
        sociability: 70, 
        //THE SCORE IT GETS COMPARED TO THE QUIZ TAKER:
        similarity: 0,
        //BITS FOR THE RESULTS PANEL:
        desc: "Bold, beautiful and brilliant - your best match is Marlene!<br> You're intelligent and powerful. Your friends love you and whilst no-one wants to mess with you,  everyone agrees - you are great! <br> In the wild there are only 600,000 African elephants and it is officially classed as vulnerable.",
        img: "../../Doggo-particular/dist/pictures/Marlene/Marlene.png",

I have used this website as a tutorial:

https://moonbooks.org/Articles/How-to-add-an-image-in-a-HTML-page-using-javascript-/

The path on "img:" does not work and the code reference from the website gives me errors . Can someone help me on how to display the image? I wouldnt mind placing the picture in the same folder and then calling it, I tried this method as well and it did not work.

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