Adding images to an HTML document with javascript

后端 未结 6 1960
故里飘歌
故里飘歌 2020-11-30 04:22

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 =          


        
6条回答
  •  一个人的身影
    2020-11-30 04:43

    Get rid of the this statements too

    var img = document.createElement("img");
    img.src = "img/eqp/"+this.apparel+"/"+this.facing+"_idle.png";
    src = document.getElementById("gamediv");
    src.appendChild(this.img)
    

提交回复
热议问题