网页之不断弹射的文字-特效
<style type="text/css">6t&of?X#supertext {
position:absolute;
left:0;oQ"a*F#o]!Y7\
top:0;.V@y%_j.s ~2\gz?
visibility:hide;(Kk j8^!e
visibility:hidden;1R \-h)e#^S"N
}
</style>
<script language="JavaScript1.2">!hv9LmD0^
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';K wYR%K3~1SKw9];F)z
<!-- 改变下的弹跳速度-->U1g9^-dJ }A4w!x];V
var BallSpeed = 20;4wn$Hv)^@6n8W\
var contentWidth;
var contentHeight;
var maxBallSpeed = 50;
:~*t?;MYN,On4f1G
3CJ E _Uf
var xMax;W(YHE`T;z,@1s
var yMax;@W]8s2`~4vt&b
var xPos = 0;
var yPos = 0;Q A)K6]n,Mh!x@7~
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;F H.u(S!G1n
var tempBallSpeed;Ru/M+L~
var currentBallSrc;2f's`p5}8E
var newXDir;
var newYDir;
:sw L:{'a j
function initializeBall() {-hUF^aBZa
if (document.all) {/s;k zui;k2M
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";I`1FJ1o^
contentWidth=supertext.offsetWidth2h,u,P3D*a~U`GM
contentHeight=supertext.offsetHeight
}b:Z0i#o*M.rNr9O \
else if (document.layers) {.N%W |^P"z\@
xMax = window.innerWidth;+iPQy8G8oxo;P
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);,q U:iSOC(DZ#UI
if (hidetimer!='') ?4M:f5I4A;_ Y
setTimeout("hidetext()",hidetimer)
}#^ i\lc
function moveBall() {
if (superballRunning == true) {)`6sRg)A n
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;o0~%n1|R+Q-z,a
}
else if (document.layers) {*AE$XgKu^/NT
document.layers["supertext"].left = xPos + pageXOffset;4ktcpY%E,p S
document.layers["supertext"].top = yPos + pageYOffset;e!a0nL4x9Kf
}
animatetext=setTimeout('moveBall()',20);
}
}0V7C:]o b`3U'Dp-P
!H)U"Y?pz5F#{6F:~
function calculatePosition() {.PH'n oT4o
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {Zm~5R O*`
xDir = "left";$D|B8y_$}
}
}BHp| rmT
else if (xDir == "left") {8C)^ w7g y
if (xPos < (0 + BallSpeed)) {Yt:_eMe-P
xDir = "right";
};jo d]*x}
}
if (yDir == "down") {pSG t&G!?O+G!b*c \
if (yPos > (yMax - contentHeight - BallSpeed)) {| rB(Sup
yDir = "up";,|5w [{ncD
}
}7gW+EE f&e&q8P
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {z u.u1Ms
yDir = "down";0opaK2N;z
}EtP4D%@"i;t
}
if (xDir == "right") {8s{/Z&`*t$M&eG
xPos = xPos + BallSpeed;
})|:T)u&`;d
else if (xDir == "left") {oSS!z_"G Y
xPos = xPos - BallSpeed;
}7P[EmISS%dl
else {M4v3R*H$]%K
xPos = xPos;%fE5j/S G
}
if (yDir == "down") {mM ux,fqR
yPos = yPos + BallSpeed;'Lg:y,b7uoU!^dMZ [
}/k^ EF Cj
else if (yDir == "up") {,k3{ o-u5[ ^s
yPos = yPos - BallSpeed;f;X*{n$i3B-C/q
}
else {RB!CYcdC
yPos = yPos;R&b!m)GQ1F$jl`*S ^+@
}
}
function hidetext(){
if (document.all)
supertext.style.visibility="hidden" Mo/f'Qq/L
else if (document.layers):Mt/MD }:kX
document.supertext.visibility="hide"
clearTimeout(animatetext)
}
-RN)F PM\0|4E
if (document.all||document.layers){?:a+Q [x${y5Nr
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;,_8[ ?3hn0G+[b
window.onresize = new Function("window.location.reload()");D_0p#N#v@)?&D
}
!w%@#dP%RWB-G
</script>
页:
[1]