Answers for "x.innerHTML += document.body.appendChild(x); x.style.width="100px";"

0

x.innerHTML += document.body.appendChild(x); x.style.width="100px";

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">

var position=0;

function deplacement(){

 position=position+20;
 var mon_element=document.getElementById("element_a_deplacer");

 mon_element.style.marginLeft=position+'px';

 if(position<=300){
  setTimeout(deplacement,50);
 }
}
</script>
</head>
<body>

<div id="element_a_deplacer" style='margin-left:0px;height:30px;width:30px;background:red;'></div>
<br>
<button onclick='deplacement()'>teste</button>
</body>
</html>
Posted by: Guest on July-17-2020

Code answers related to "x.innerHTML += document.body.appendChild(x); x.style.width="100px";"

Code answers related to "Javascript"

Browse Popular Code Answers by Language