Reputation: 77
Taking image
from the same folder the index
and javaScript
files are in, but for some reason it does not load.
And the error it gives me is,
"Failed to load resource: the server responded with a status of 404 (Not Found)"
var img = dcoument.createElement("IMG");
img.height = 500;
img.width = 340;
img.src = '/img.jpg';
document.getElementById("addImgHere").appendChild(img);
Upvotes: 1
Views: 1174
Reputation: 46
Your code works just fine.
You have two issues in your code:
Incorrect:
var img = dcoument.createElement("IMG");
Correct:
var img = document.createElement("IMG");
Upvotes: 3