查看完整版本: 按钮控制窗口移动

heking520 2008-1-12 02:12

按钮控制窗口移动

要完成此效果把如下代码加入到<body>区域中
<script>
var xx
var v=1

function ml() {
clearTimeout(xx)
window.moveBy(-v, 0);
xx = setTimeout("ml()",140)
}
function mr() {
clearTimeout(xx)
window.moveBy(v, 0);
xx = setTimeout("mr()",140)
}
function mu() {
clearTimeout(xx)
window.moveBy(0, -v);
xx = setTimeout("mu()",140)
}
function md() {
clearTimeout(xx)
window.moveBy(0, v);
xx = setTimeout("md()",140)
}
function ws(){
clearTimeout(xx)
}
function adj(i){
if (i==1){v+=1; if (v>5)v-=1}
else {v-=1
if (v==0)v=1}
}
</script>
<DIV align=center>
<FORM>
    <INPUT onclick=mu(v,0); type=button value=向上>
     
    <INPUT onclick=ml(v,0); type=button value=向左>
     
    <INPUT onclick=mr(0,v); type=button value=向右>
     
    <INPUT onclick=md(0,v); type=button value=向下>
     
    <INPUT onclick=ws(); type=button value=停止>
    <BR><BR><BR>
    <INPUT onclick=adj(1); type=button value=加速>
    <INPUT onclick=adj(0); type=button value=减速>
     <BR></FORM></DIV>

sapling 2008-1-18 11:23

路过的人,支持,支持!!

nancy 梦游 2008-1-18 11:29

您的帖子太好看了!我愿意一辈子的看下去!

NO.5 2008-1-18 11:32

这种贴,啥话都别说,顶上先!!
页: [1]
查看完整版本: 按钮控制窗口移动
5.12四川大地震