変数カウンターを取り出してdocument.getElementById("movee").style.top
数値に等しく設定すると、正常に動作します。変数カウンターとそのコードを組み合わせると、理論的には画像が動きます。なのになぜかうまくいかない!
<html>
<style type="text/css">
#movee
{
position:absolute;
}
</style>
<script type="text/javascript">
function goDown()
{
var counter=1;
while (counter<300)
{
document.getElementById("movee").style.top="counter";
var counter=counter+1;
}
}
</script>
<input type="button" onclick="goDown()" value="Move!">
<img src="test.png" id="movee"></img>
</html>