我有一个如下所示的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>
我想将内部DIV(名称为child)从顶部向下逐像素移动100个像素。我认为可以使用style.marginTop =''和settimeout()函数来实现。
但仍然不能使其正常工作。