如现有图片images1:
<div id="div1">
<img id="images1" src="..."/>
</div>
可能通过以下js实现图片的上、下和左、右移动。
var div1 = document.getElementById("div1");
if(s == "up"){
div1.style.top = (parseInt(div1.style.top) + 100) + "px";
}else if(s == "down"){
div1.style.top = (parseInt(div1.style.top) - 100) + "px";
}else if(s == "left"){
div1.style.left = (parseInt(div1.style.left) + 100) + "px";
}else if(s == "right"){
div1.style.left = (parseInt(div1.style.left) - 100) + "px";
}
当然这里是100px来移动的,如有需要可以修改。