网页之不断弹射的文字-特效
<style type="text/css">9] rcM6A#supertext {
position:absolute;FLe\Y+K
left:0;
top:0;s;I[)yuT
visibility:hide;Xb9f?*z0at
visibility:hidden;
}:q RX6pwH7J#\8i
</style>9n } O/`:n0w.b2U
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'*}1uO$^o8W
var hidetimer='';
<!-- 改变下的弹跳速度-->;coo'jj:Gi
var BallSpeed = 20;
var contentWidth;7_b VowDjpT)t
var contentHeight; gI6_"`1dP4f!oj EN
var maxBallSpeed = 50;A L/K's'l|({!D
i8u,L@2lE z{
1d9m9OB&Dg-p
var xMax;/[/IWt8TF
var yMax;
var xPos = 0;
var yPos = 0;+k/Df:e }
var xDir = 'right';3kb~0E1Oc
var yDir = 'down';F;h/_2^t#G%N
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;/Qq3UY {rH`P
var newYDir;!h*_(`*|]6S+[bo
cP0\~'`y.V
function initializeBall() {5ru,G@dA#f!{8x)w
if (document.all) {)IX*Y*L Z/GJ|,t
xMax = document.body.clientWidth.nY*_)p!`.M,pax1k&c
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidthZ8h5F _(oM-z)[]L
contentHeight=supertext.offsetHeight V D%J)g)D-Mu*v/?1{
}
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.heightP$\)UF#`4Ca
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);5c1P.J qn(] Wv
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}
function moveBall() {!wQ*y9KV HU
if (superballRunning == true) {$H9X,N{&LH5U E3O
calculatePosition();-jn6~4[o"\;E7?Xkd
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;#D`'g;E3w;`Gt
document.all("supertext").style.top = yPos + document.body.scrollTop;
}I#\%G%Se/h b
else if (document.layers) {`[ U6js.p"e%f
document.layers["supertext"].left = xPos + pageXOffset;MY'y s7}"\0Q6F$~M
document.layers["supertext"].top = yPos + pageYOffset;6l5K E|R:N
}
animatetext=setTimeout('moveBall()',20);!S$M%V(\F!{T
}m\MV3u"e+x6]k:m*|
}
7_|u%TE
function calculatePosition() {
if (xDir == "right") {'@L$L0@{(yMw#k#wV]
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";CA}X(T)y}^
}a$Rb+n Yw
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {:W E [rX
xDir = "right";Y{;?t x}\
}
} @9?/m^!Lu&aAt
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}/AQTTg p/@8`
}
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {e p6S8F8@2[]6g
yDir = "down";K%Dm_@X/n
}
}
if (xDir == "right") {7m'v9\ y4Z;X'WE
xPos = xPos + BallSpeed;8A6y q~,AmT+P M
}j0u5tXA6? F1Tk,C
else if (xDir == "left") {
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;V+HtJRm6E*W
}Z9d6atfBu`
if (yDir == "down") {Gc{A g+I(S!J+]v
yPos = yPos + BallSpeed; `jTi:LugP H
}
else if (yDir == "up") {8Jc-] ZF wr&j:~
yPos = yPos - BallSpeed;
}y/p+R BT
else {
yPos = yPos;
}*V&q6cM%W"\4G
}
function hidetext(){ r Gx7I8f;^
if (document.all)&LC(I E/L/{2Rk ~)D
supertext.style.visibility="hidden"5eOR-b7x2K
else if (document.layers)7l9^G8ZEy
document.supertext.visibility="hide"
clearTimeout(animatetext)0bl(b'@w
}5~!j,]Bi
]P^'d&{
if (document.all||document.layers){@s6^.On s3G
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;3Fa+l.~w
window.onresize = new Function("window.location.reload()");
}$c4{1Uy}0z
E`OXI3]F5^I
</script>
页:
[1]