感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<p>
<button onclick="myMove()">点我</button>
</p>
<div id="myContainer">
<div id="myAnimation"></div>
<div id="myAnimation1"></div>
</div>
xxxxxxxxxx
function myMove(){
var elem=
document.getElementById
("myAnimation1");
var pos=10;
var id=setInterval(frame,100);
function frame() {
if(pos==1000){
clearInterval(id);
}else{
pos++;
elem.style.top=pos+'px';
}
("myAnimation");
if(pos==10000){
elem.style.left = pos + 'px';
#myContainer {
width:400px;
height:400px;
position:relative;
background:white;
#myAnimation{
width:50px;
height:50px;
position:absolute;
background-color:black;
#myAnimation1{
width:25;
height:25px;
background-color:blue;