Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda