网页之不断弹射的文字-特效
<style type="text/css">]gf3ok7H3B:^:b\#supertext {EF Q4l4E8P2@
position:absolute; X+d/@)NlnNB
left:0;~kV'a0r`
top:0;
visibility:hide;:c/Ef5ZJ
visibility:hidden;
}7z5u;wWG(O&q7PP
</style>,bQe,^d*~zt&W
<script language="JavaScript1.2">@RsIa,?d vnY
<!-- 改变下的字体的大小。颜色-->`)xHoi$Lp*P%~
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';
<!-- 改变下的弹跳速度-->(I S5BA.@/n|OVg/z
var BallSpeed = 20;
var contentWidth;6R4i'v~7w`Fu;_
var contentHeight;:U M]`_'Uj7j]Ah
var maxBallSpeed = 50;+g6lF7A5An5`Lm
E/UGaQ.uO
{ P5Pr s
var xMax;$y:L7vecF1jL+H
var yMax;/XKK5jkL,Key
var xPos = 0;
var yPos = 0;]n]3L G7}{Y
var xDir = 'right'; a_3_3`9d? mV5q*Y
var yDir = 'down';2Z xq/I3H{)~&X(T
var superballRunning = true;
var tempBallSpeed;4VD4aY(sl
var currentBallSrc;
var newXDir;'Q9r"F"Z"lk3H
var newYDir;
function initializeBall() {
if (document.all) {*ko#rq!l
xMax = document.body.clientWidthqc _ Nn
yMax = document.body.clientHeight"Y ne6| T
document.all("supertext").style.visibility = "visible";S$VF@8l4M*H:? FuL_
contentWidth=supertext.offsetWidthy$t?bqfb
contentHeight=supertext.offsetHeight8JY6ZHB.Mv-f
}{d ~lm~qG7X u_
else if (document.layers) { ~w$Z+|kY
xMax = window.innerWidth;o Y*[.f}*tG1} g W
yMax = window.innerHeight;
contentWidth=document.supertext.document.widthB gB4TVYS
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";cSD5ay5n/LU4bY
}
setTimeout('moveBall()',400);S8? UQ ?7qP1u5n
if (hidetimer!='')4L0TH}x
setTimeout("hidetext()",hidetimer)
}
function moveBall() {i"\(P_s$hs)zyoX8i
if (superballRunning == true) {F[JtGxe
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop; j-LKe)b0a
}
else if (document.layers) {3oA"P njW
document.layers["supertext"].left = xPos + pageXOffset;#y(wD#?F]jY
document.layers["supertext"].top = yPos + pageYOffset;
}
animatetext=setTimeout('moveBall()',20);:t/J_jw3y T9uB^
}3k+F%i+lB#hFr(g$_,R
}C]xi!X]!L#u~
function calculatePosition() {jK\"M+Gm z \
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";;Y:jyQ$l]%Fr
}
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {-Cag6x;|%}}b2a
xDir = "right";
}Cud]2ou
}?:k%bpsE1yj
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";y)vGP5f;f3Ef'b
}
}a}a,Q7M0|h
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";qytM"m@)j uo
}$Zebo-W
}AW%qA)KO
if (xDir == "right") {
xPos = xPos + BallSpeed;4hZ$Ckx
}pB:yx[o:n g5Htg
else if (xDir == "left") {`Z*if!ZH
xPos = xPos - BallSpeed; xH\)k;@5Oy
}K o-{z7Rsu_!x
else {/^1NN+f | HC!@
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;r&q(cZ pl V
})y6O2o*d \Im-m$_
else if (yDir == "up") {1g!\^|%A0jMt&Z
yPos = yPos - BallSpeed;Mj Jp"}H*Q
}-j!X9Z\f a
else {'Iqx/f.o
yPos = yPos;
}
}
function hidetext(){lJEJPL Z7Oa6O
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"ua:A0\ i
clearTimeout(animatetext)1d W `0I2k&|u5E@'Y
} jc#t%R$Wh8T
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')c P#P/yM A\2s2d[0}9F
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");kj3~_zQW]6[VS
} K%ZXd2o4VCaLv4H
</script>
页:
[1]