How to add a new Image every few seconds in a innerHTML tag without breaking "<br>" JavaScript, HTML5 -


i trying create basic game ledges jump on, wanted figure out. question is, using innerhtml tag insert new image every few seconds, when breakes <br> itself. how add new image in innerhtml tag without breaking?

function landt() {     document.getelementbyid("land01").innerhtml += "<pre><img src =\'images/platform00.png\'></pre>";     movemyp(); }  function movemyp() {     var thistimer = settimeout(movemyp, 500);     moveblock1 = moveblock1 - 10;     document.getelementbyid("land00").style.left = moveblock1 + "px"; } 

your images inside pre block element.

you can modify display css property inline or redesign code not use pre tag.

have considered using createelement function instead of innerhtml? difference explained here


Comments

Popular posts from this blog

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

matlab - error with cyclic autocorrelation function -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -