📄 弹出的一个窗口,可以在屏幕的范围内自动进行壁前回转.htm
字号:
<head><script>
var x=0, y=20, dx=4, dy=4, interval=10;
var win= window.open('1.htm', 'popwindow',"width=200,height=130, top=0, left=24, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
win.moveTo(x,y);
var intervalID=window.setInterval("bounce()",interval);
var sw=screen.availWidth-210
var sh=screen.availHeight-100
function restart(){
interval=10;
win= window.open('1.htm', 'popwindow',"width=200,height=130, top=0, left=24, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
x=0, y=20//, dx=4,dy=4;
win.moveTo(x,y);
intervalID=window.setInterval("bounce()",interval);
bounce()
}
function bounce(){
if (win.closed) {
clearInterval(intervalID);
return;
}
if ((x+dx > sw) || (x+dx < 0)) dx = -dx;
if ((y+dy > sh) || (y+dy < 0)) dy = -dy;
x += dx
y += dy
win.moveTo(x,y)
}
function slower(){
dx=dx/2,dy=dy/2
clearInterval(intervalID);win.close()
restart()
}
function faster(){
dx=dx*2,dy=dy*2;
if (dx>64) dx=64,dy=64;
clearInterval(intervalID);win.close()
restart()
}
</script></head>
<body><input type=button value="关闭移动窗口 " onClick="clearInterval(intervalID);win.close();" name="button" class="bottom">
<input type=button value="重新打开移动窗口" onClick="restart();" name="button22" class="bottom">
<input type=button value="窗口减速成" onClick="slower();" name="button2" class="bottom">
<input type=button value="窗口加速" onClick="faster();" name="button2" class="bottom"></body>
弹出窗口的大小根据1.htm页面的内容而定,修改尺寸请在第一步的 Javascript 里记得要修改两个地方:
var win= window.open('1.htm', 'popwindow',"width=200,height=130, top=0, left=24, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
win= window.open('1.htm', 'popwindow',"width=200,height=130, top=0, left=24, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -