Adding images to the html with javascript
Posted
by Anonymous
on Stack Overflow
See other posts from Stack Overflow
or by Anonymous
Published on 2010-04-29T08:44:14Z
Indexed on
2010/04/29
8:47 UTC
Read the original article
Hit count: 175
I've tried some HTML DOM code from several sites, but it isn't working. It isn't adding anything. Does anyone have a working example on this?
this.img = document.createElement("img");
this.img.src = "img/eqp/"+this.apparel+"/"+this.facing+"_idle.png";
src = getElementById("gamediv");
src.appendChild(this.img)
But it isn't adding anything to the div. (gamediv) I've tried document.body as well, with no result.
Thanks in advance.
© Stack Overflow or respective owner