📄 网页作坊--撞壁球.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0054)http://pagediy.home.chinaren.com/script/image/009s.htm -->
<HTML><HEAD><TITLE>网页作坊--撞壁球</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="文本/html; 字符集=gb2312" http-equiv=目录类型>
<SCRIPT>
<!--
// http://oke.yeah.net
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
// 速度,越小越快
var tempo=10
// 单位时间内水平移动的距离
var stepx=20
// 单位时间内上下移动的距离
var stepy=20
var timer
// 图象的路径
img0 = new Image();
img0.src = "ld.gif";
img1 = new Image();
img1.src = "lu.gif";
img2 = new Image();
img2.src = "rd.gif";
img3 = new Image();
img3.src = "ru.gif";
// 延迟两秒开始运动
function setValues() {
var firsttimer= setTimeout("setValues2()",2000)
}
function setValues2() {
if (document.all) {
marginbottom = document.body.clientHeight-50
marginright = document.body.clientWidth-50
document.all.ball.style.posLeft=randommaker(marginright-30)+30
document.all.ball.style.posTop=10
moveball()
}
if (document.layers) {
marginbottom = window.innerHeight-10
marginright = window.innerWidth-10
document.ball.left=randommaker(marginright-30)+30
document.ball.top=10
moveball()
}
}
function randommaker(range) {
rand=Math.floor(range*Math.random())
return rand
}
function moveball() {
checkposition()
chooseimage()
if (document.all) {
document.all.ball.style.posLeft+=stepx
document.all.ball.style.posTop+=stepy
timer=setTimeout("moveball()",tempo)
}
if (document.layers) {
document.ball.left+=stepx
document.ball.top+=stepy
timer=setTimeout("moveball()",tempo)
}
}
function checkposition() {
if (document.all) {
if (document.all.ball.style.posLeft>=marginright) {
stepx=stepx*-1
document.all.ball.style.posLeft-=10
}
if (document.all.ball.style.posLeft<=marginleft) {
stepx=stepx*-1
document.all.ball.style.posLeft+=10
}
if (document.all.ball.style.posTop>=marginbottom) {
stepy=stepy*-1
document.all.ball.style.posTop-=10
}
if (document.all.ball.style.posTop<=margintop) {
stepy=stepy*-1
document.all.ball.style.posTop+=10
}
}
if (document.layers) {
if (document.ball.left>=marginright) {
stepx=stepx*-1
document.ball.left-=10
}
if (document.ball.left<=marginleft) {
stepx=stepx*-1
document.ball.left+=10
}
if (document.ball.top>=marginbottom) {
stepy=stepy*-1
document.ball.top-=10
}
if (document.ball.top<=margintop) {
stepy=stepy*-1
document.ball.top+=10
}
}
}
function chooseimage() {
if (document.all) {
if (stepx <= 0 && stepy <=0) {ballimage.src="images/lu.gif"}
if (stepx >= 0 && stepy <=0) {ballimage.src="images/ru.gif"}
if (stepx <= 0 && stepy >=0) {ballimage.src="images/ld.gif"}
if (stepx >= 0 && stepy >=0) {ballimage.src="images/rd.gif"}
}
if (document.layers) {
if (stepx <= 0 && stepy <=0) {document.ball.document.ballimage.src="images/lu.gif"}
if (stepx >= 0 && stepy <=0) {document.ball.document.ballimage.src="images/ru.gif"}
if (stepx <= 0 && stepy >=0) {document.ball.document.ballimage.src="images/ld.gif"}
if (stepx >= 0 && stepy >=0) {document.ball.document.ballimage.src="images/rd.gif"}
}
}
// -->
</SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff onload=setValues()>
<DIV id=ball style="POSITION: absolute; TOP: -50px"><IMG border=0 name=ballimage
src="网页作坊--撞壁球.files/rd.gif"></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -