<html>
<head>
<title>点击按钮移动的div(1.1作品)</title>
</head><BODY>
<input type="button" value="↑" onclick="up()">
<input type="button" value="←" onclick="left()">
<input type="button" value="↓" onclick="down()">
<input type="button" value="→" onclick="right()">
<div id="a" nowrap style="position:absolute; left:5; top:50; width:100; height:40; z-index:1; overflow: auto; overflow:hidden">
壹点壹作品
</div>
<script>
var distance=50;
function left(){
a.style.left= (parseInt(a.style.left) - distance) + "px";
}
function right(){
a.style.left= (parseInt(a.style.left) + distance) + "px";
}
function up(){
a.style.top = (parseInt(a.style.top) - distance) + "px";
}
function down(){
a.style.top = (parseInt(a.style.top) + distance) + "px";
}
</script> </body></html>
点击按钮移动的div
猜你喜欢
转载自blog.csdn.net/wei123456/article/details/2199515
今日推荐
周排行