Image does not load with JavaScript

2

Why does not my image on my desktop load my HTML page?  I'm doing it through JavaScript, but just upload the images from the internet by putting the url.

This is my code:

function mostrar()
{
  var src = "C:\Users\User\Desktop\fondo.jpg";
  imagen1.src = src;
}
    
asked by Javier 25.12.2017 в 16:22
source

1 answer

3

You can try adding file: /// to the content of the variable SRC . It would be:

var src = "file:///C:Users/User/Desktop/fondo.jpg"
    
answered by 25.12.2017 в 17:01