网页之不断弹射的文字-特效
<style type="text/css">#supertext {
position:absolute;Xy&`y9u)e C8|
left:0;``Z9Aa-~-?#y6S._
top:0;
visibility:hide; p-Z.dg}N:i
visibility:hidden;.E'lu(l-~?O*E
}
</style>
<script language="JavaScript1.2">'YbQ&]$u
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' e0a)]GgL_2X
var hidetimer='';x(Tyx.b1F)tU
<!-- 改变下的弹跳速度-->`1GUAP$P
var BallSpeed = 20;"`9ZO;e VA
var contentWidth;!M'~P9}2}z%U xx'x h
var contentHeight;
var maxBallSpeed = 50;-U,A U;TP%h"zbs
/i6]$W^&WX2``7Xv
var xMax;
var yMax;
var xPos = 0;
var yPos = 0;sY#Gi n
var xDir = 'right';~%Wx#CIKs
var yDir = 'down';jRso(q9L
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;Dt \teNn
var newXDir;
var newYDir;
)MA0{jT{
function initializeBall() {
if (document.all) {Cf4h(vU\(Ly4Hj
xMax = document.body.clientWidth
yMax = document.body.clientHeight6I#Il/@z9m)x.JO
document.all("supertext").style.visibility = "visible";/DFx/P&m6P9Ox.N@:`:i
contentWidth=supertext.offsetWidthU3r l|(t-Yc G
contentHeight=supertext.offsetHeightx$y+y9H0f}p4c
}5E+Y+b d.TU
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;0J[8l e5lr&?6?I
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}v vEpG6~T
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}3Gl~ iGt-jz
F y1BLPb} xe
function moveBall() {
if (superballRunning == true) {
calculatePosition();z N@!MW(u4]LNO
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;$jG5gN}9n5M
document.all("supertext").style.top = yPos + document.body.scrollTop;/B2e[ Xn9okY
}
else if (document.layers) {,qRGNIDwL
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;%y0{'hK$IEjA8y
}M'u'PDP9EgB^
animatetext=setTimeout('moveBall()',20); H*W0yaHH%C~ ^K
} PyvzpV
}X g-D;kIr
function calculatePosition() {v9f3b"_4z)K
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {bx5dB*SHf%BT
xDir = "left";
}
}r8HcSuat;b,k`
else if (xDir == "left") {5k3nE@*z
if (xPos < (0 + BallSpeed)) {w QJ7q3A"_b,LOJ
xDir = "right";
}
}
if (yDir == "down") {N0WyfQ5K
if (yPos > (yMax - contentHeight - BallSpeed)) {}4`k8YhA
yDir = "up";
} gh-AR em z0GU
}(nDgb{7l{
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";8E V s3Yj%m }$AQ
}9R M)_ gu*Bq\ qS r
}
if (xDir == "right") {pU%p p,`
xPos = xPos + BallSpeed;{)t*F7^cuA
}
else if (xDir == "left") {D#] IBjY[C
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;
}!P3fb `4Q7?!`
if (yDir == "down") {
yPos = yPos + BallSpeed;
}8a-\P nz
else if (yDir == "up") {)}%~7a6af)q
yPos = yPos - BallSpeed;
}"RxD8]pn
else {]KV*@&_
yPos = yPos;
}
}
function hidetext(){R+Ab ]J4f}
if (document.all)U8k2i(n;]
supertext.style.visibility="hidden"
else if (document.layers)US$M"dG&ZT;}#Y}
document.supertext.visibility="hide"
clearTimeout(animatetext)R/JEW4ps'G
}
)M ?yd)Z9Q+h
if (document.all||document.layers){'ME![@*R$|
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')2du.ft5rI Ee8U
window.onload = initializeBall;KJ0g ID,g%HkY$z
window.onresize = new Function("window.location.reload()");?W7C-hQrW8D's4p
}
5[$Eg-H0Y+k
</script>
页:
[1]