我有这样的DIV设置。如何按像素移动DIV像素
<div id="parent" class="parent">
<div id="child" class="child">
</div>
</div>
样式
<style>
.parent{
float:left; height:300; width:300px; background-color:#00ff00;
}
.child{
float:left; height:60; width:60px; background-color:#00ff00;
}
</style>
<script>
function move(){
while(m < 100){
document.getElementByid('child').style.marginTop = m;
m = m+1;
}
}
move();
</script>
我想通过像素从顶部100个像素移动内部DIV(名为子)像素底部。 我认为它可以使用style.marginTop =“”和的setTimeout()函数
但依然没能得到这个工作完成。
向我们展示你的JavaScript代码。 – Halcyon 2013-03-01 16:40:25
你是指动画吗? – Dogoku 2013-03-01 16:40:30
@dogoku是动画。 – 2013-03-01 16:41:27