网页之不断弹射的文字-特效
<style type="text/css">#supertext {-o VuMe
position:absolute;v4Qp o*p1S([
left:0;
top:0;j/S!FT"M.ZO,c
visibility:hide;
visibility:hidden;}6Qt-Ud
}4^.S)},r(E r
</style>OZNf%GSh&\e0P
<script language="JavaScript1.2">^|%N2T7nL0fb([
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' yaab:n$]1N/r%@
var hidetimer='';w5q}#K_;J!`9Qsr-k-R
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;fo S4V:l%K
var contentWidth;
var contentHeight;,T+Zc"{8i4q
var maxBallSpeed = 50;
:n,pE|Uc
var xMax;t!Cp6r6i%t+xsx
var yMax;O6N3y;H:j,u
var xPos = 0;%q3L!fJr
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;/x2qZ,DUz
var tempBallSpeed;
var currentBallSrc;t-J(gR9U5Y
var newXDir; e l/y7zb9iQ
var newYDir;
function initializeBall() {)r,Vi)pa'QO,}2n
if (document.all) {Ky$U v%S0?~
xMax = document.body.clientWidth
yMax = document.body.clientHeight(P/eP mu(P`$o$e
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidthg@2JE5rtX
contentHeight=supertext.offsetHeightL;F?{pGK%~zA
}
else if (document.layers) {9\'\keQ1cm bq
xMax = window.innerWidth;7EPk%Q6S)|$g^
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height V,NZG&l,\
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);-kT'hHWa3{_8T
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}
{e4aY3w \Z T
function moveBall() {
if (superballRunning == true) {
calculatePosition();#R Ep)S)_
if (document.all) {ij)L"a I"B w0R G
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;
}}I9x5L(C9@F/v:`^]
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;Z(Jb5jUD2~
document.layers["supertext"].top = yPos + pageYOffset;lRlT.WWe`.EP
}
animatetext=setTimeout('moveBall()',20);e1qkHX|
}{%J:V4[6W
}k C,\)Y*T#A
function calculatePosition() { l ?1n5X,h+rXE&Q
if (xDir == "right") {+{iqUdX,N
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {$jc8i*}t(E*h
xDir = "right";9RScW:d-c P;T
}
}L+J5qj4C'[2aR
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {ylejX[#e
yDir = "up";&T?4r7]0@e
}
}Z.i6LKg%n'Y7o
else if (yDir == "up") { GhS3r-i1zM*~dk
if (yPos < (0 + BallSpeed)) {
yDir = "down";$td"R!ys0h7AR ^
}
}
if (xDir == "right") {4RA8Q]-ki8v6JYY
xPos = xPos + BallSpeed;
}&?;Hd LSp6G,nxB
else if (xDir == "left") {
xPos = xPos - BallSpeed;.NT/ODcZQ2B
} o0G4~&D]bG B
else {
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;#NIp|M!i
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;#A,fs,Y\X8aQ
}
else {7xf7R}f+KB-y
yPos = yPos;
}
}t JMSsAcS
9[6\6R%NPbRi zb{
function hidetext(){P7`f O }
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"Dp&J?/KH.N"F
clearTimeout(animatetext)X \K]6z"z+X
}n(} BK5P
W.v cp'T ]S{
if (document.all||document.layers){}eH%`,T/Y%Y3j`
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall; y+Y(Z cf,b)c
window.onresize = new Function("window.location.reload()");
}
\Ko)YT$g-U \'E
</script>
页:
[1]