(一).示例图片
(二).代码
<html>
<head>
<title>层的移动</title>
</head>
<body>
<div id="layer1" style="position:absolute;top:150px;left:150px;background-color:lightblue;">
操作层
<form>
<input type="button" value="上" οnclick=moveup() width="150px">
<br>
<input type="button" value="左" οnclick=moveleft()>
<input type="button" value="中">
<input type="button" value="下" οnclick=moveright()>
<br>
<input type="button" value="?" οnclick=movedown()>
</form>
</div>
<script language="javascript">
<!--
function moveup()
{
document.all.layer1.style.pixelTop+=(-20)
}function movedown()
{
document.all.layer1.style.pixelTop+=20
}function moveleft()
{
document.all.layer1.style.pixelLeft+=(-20)
}function moveright()
{
document.all.layer1.style.pixelLeft+=20
}//function showhide()
//{
//if (document.all.yellowbox.style.visibility=="hidden")
//document.all.yellowbox.style.visibility="visible"
//else
//document.all.yellowbox.style.visibility="hidden"
//}
//-->
</script>
</body>
</html>