捌玖网络工作室's Archiver

zw2004 发表于 2008-1-21 20:55

网页之不断弹射的文字-特效

<style type="text/css">EEQ1j$Q`W yh
#supertext {T-Atp%uP ^/Q
position:absolute;
)\SsP}JQ6N left:0;
kF J9k9Mp#muQ top:0;
5s5G \zOJ visibility:hide;R{ Bu zHO
visibility:hidden;
r$^N6g:^O;L } U"FA6D&j
</style>$f8_POPo#x
<script language="JavaScript1.2">0]BB'K8DQ&n
<!-- 改变下的字体的大小。颜色-->C Yu%Rf ZZu4nh
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'h;]X"G_tz3cD
var hidetimer='';
$tJS5i6g_ <!-- 改变下的弹跳速度-->
{my MShF:V var BallSpeed = 20; Q^!{H`H#o
var contentWidth;F_)y/F uY
var contentHeight;
0T'b5v uOAr+v var maxBallSpeed = 50;4T7Y}eCS

ItjLc$Ar,X
~2DtZGnG)BG:~^ var xMax;
s juu'UO.zH u var yMax;
S;d#~L)wV u!c a var xPos = 0;b;bwoq*O'i8I
var yPos = 0;QCJ$vH
var xDir = 'right';
kQ7t.H.H+z$u var yDir = 'down';,P a!@0R*i!b
var superballRunning = true;
+D8](O"L.T1DSxX var tempBallSpeed;
tZ |3@3x0n,q8t var currentBallSrc;*FV:R7^[P|Q+M c g
var newXDir;X$zCh Y"i6y3M+zHv
var newYDir;
Kw @9l V,U.x nJqt~2]xu!l0w
function initializeBall() {?t.wh&|LM E
   if (document.all) {
M)Aufw)ty       xMax = document.body.clientWidthJ K\}4Muc
      yMax = document.body.clientHeight
)j2Lmv8~/y(p       document.all("supertext").style.visibility = "visible";
U7u}k.Z[       contentWidth=supertext.offsetWidth CMl9r }.f0i
      contentHeight=supertext.offsetHeight
3RU$T%YwYG\       }iv*\aE;goY
   else if (document.layers) {'B,l n,_4Vz J1B
      xMax = window.innerWidth;
6H|1v-u^F.A|       yMax = window.innerHeight;Gh*v&fazrOH M
      contentWidth=document.supertext.document.widthK}$mR,@['N4d0F8ir~
      contentHeight=document.supertext.document.height
i9S"kCvA       document.layers["supertext"].visibility = "show";(OH.{7u4D.XA @b/U
      }
~D/gy"`^Z    setTimeout('moveBall()',400);
/ck+X AL    if (hidetimer!='')
(AAtV\    setTimeout("hidetext()",hidetimer)
KjY*T1iSC Nk    }v:b&TEGHek

h U.`Q5UF k4x%V function moveBall() {
!u}3e#B0Q]^    if (superballRunning == true) {
p!C[]0M_       calculatePosition();\/u[ Ztdh
      if (document.all) {.I9_Z6cL [~;@
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
Df1^-q4T ~9[7nS          document.all("supertext").style.top = yPos + document.body.scrollTop;ZJ w WH2o
         }:R!qgwTh6b9E
      else if (document.layers) {
2q4h%q'i`          document.layers["supertext"].left = xPos + pageXOffset; I+u?/Pcs
         document.layers["supertext"].top = yPos + pageYOffset;{`%W!?Z8t0~Gg)eV
         }
4Inernd+R       animatetext=setTimeout('moveBall()',20);
'YWc8] \       }
i#wRu r O.km7_    }.{ uN&pk3EfO

S!G3T-GW Y)Pb:q function calculatePosition() {
t_ IW vo C    if (xDir == "right") {N9qH5|8Rc`A ~ w%s
      if (xPos > (xMax - contentWidth - BallSpeed)) {
C P0[jOTaB          xDir = "left";
HQ"B ^ io0j          }9Y!~zf r"BV9j!v
      }
2r!N,~p oe L8|)M    else if (xDir == "left") {&J A8_ G0YO,{
      if (xPos < (0 + BallSpeed)) {*l.w"N] sU$|
         xDir = "right";
OW%Z0npT F          }
St2?&aj T       }
;`3M Jk-}+J'v    if (yDir == "down") {~h1ME(K-b Q6JY
      if (yPos > (yMax - contentHeight - BallSpeed)) {
t;GN P`lh          yDir = "up";'^st.s P2yWN
         }
v,|"P;i5q*o       }
P6Ueh2^3n*r4O"z    else if (yDir == "up") {
A^T$\Ki y       if (yPos < (0 + BallSpeed)) {0@t+@4dAI
         yDir = "down";
B!KPHn6H"K          }Nt M$YX z;l
      } vmR__
   if (xDir == "right") {
eRti8P}*S3IE\       xPos = xPos + BallSpeed;
n2{gZj0~'z{       }
,fr-M,a a u5[mS+p    else if (xDir == "left") {
f4hr0KNI v3P       xPos = xPos - BallSpeed;!t.] sO9]d5b o
      }
js%qKC2uS)e    else {
+Ae sXFSbEu       xPos = xPos;
,qf$Fc;b:t;a'e       }
Q4Wj&j/{0A;f(L    if (yDir == "down") {
C#RKNL Y!K       yPos = yPos + BallSpeed;.l7e#\^:ilh
      }
x+t&Z5Z.Xh(@f$Q+Q    else if (yDir == "up") {
%} `9h4W3joQH j       yPos = yPos - BallSpeed; G@)?7`S wll6e
      }+h.s2l;_EeX
   else {
l6oDdQ)gyi%W       yPos = yPos;
cA-kr3Uw       }
'I ` XT A'Ts [    }
!JO#]nKq 1K"| yt~ Oq `
function hidetext(){
5M?r0E ] a if (document.all)$Dk7k5e"de
supertext.style.visibility="hidden"
dI!qR|0R else if (document.layers)mb s/z]3qm&?
document.supertext.visibility="hide"
4?:v Ok$Q9K clearTimeout(animatetext)
xJF0by$C }+m'^cw k7~3H|

DixX}j if (document.all||document.layers){$a.u M)q8{A G CO#@
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')"ji6ghPw
window.onload = initializeBall;Du!Sj2E"pTk
window.onresize = new Function("window.location.reload()");fjhn.bE9T9j2NC
}/j,UYV7Z1w$HNV4\O
$X4{ _9Kh l
</script>

页: [1]
【捌玖网络】已经运行:


Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.