捌玖网络工作室's Archiver

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

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

<style type="text/css">
q;a9\:y{ t #supertext {(m1M&di8@ e
position:absolute;
7?3JQ%[bSQ$fEBy;I left:0;
aC[/L.D\)u#}&o top:0;U*HH2qg)c x8p
visibility:hide;
N^*a \.Q(Am` visibility:hidden;g:_aZ#X:FjI
}
+Sq~/bL5y"g </style>
B U1\;eoR <script language="JavaScript1.2">j-@5_){/UB
<!-- 改变下的字体的大小。颜色--> ty}&uP&Gj
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>';S(Iw%AIR
var hidetimer='';
:eF_T"Tscv$P <!-- 改变下的弹跳速度-->
ToP? Jr var BallSpeed = 20;7D3mY sw)X5PSq|
var contentWidth;R6A4@1Sc(I {N
var contentHeight;
K(_r+]7C?o(\ var maxBallSpeed = 50;g u'Hq,q0u:H(pY"p
3L$LCS(u5n5a$ys a
S y2N&ht
var xMax;d*@~^Xa w
var yMax;
&K,x0A9eN var xPos = 0;_ aK tRHN%|
var yPos = 0;1F3q'Cd seV'b
var xDir = 'right';
Jb r(HA!PYH var yDir = 'down'; h3I p [E o{$_+Z
var superballRunning = true;
p/n5tR`#ai/u"J var tempBallSpeed;:D%Vqmp.`
var currentBallSrc;
5].S%d vo m*p var newXDir;z6a6QW~z
var newYDir;!vHRT a3F!~et

^0_9\@X-w8N E4Yr function initializeBall() {2g.f2i-cW1b
   if (document.all) {B+S}F0WY#br
      xMax = document.body.clientWidth
,h [j q2\u?|       yMax = document.body.clientHeightDOj,Tj"iT#z#S`p
      document.all("supertext").style.visibility = "visible";|#` ^QR]Q3b
      contentWidth=supertext.offsetWidth
9]^-]5q9\8T}S4Y       contentHeight=supertext.offsetHeight ? d5Eno6uDw,B
      }D(U6E:E!I7`
   else if (document.layers) {
%?rh#Q,{)]       xMax = window.innerWidth;
j1A5[Ms${       yMax = window.innerHeight; l5B*ntX.o:Hfb
      contentWidth=document.supertext.document.width
%bi9r]h       contentHeight=document.supertext.document.height
2c Il-fNo       document.layers["supertext"].visibility = "show";
UpwE7Kdd&Za6]       }\E!P?7\h&bw G
   setTimeout('moveBall()',400);
7S"u'EO%u/VQ"I    if (hidetimer!='')2D:c Hp.f7d
   setTimeout("hidetext()",hidetimer)
5}#akJk9J-^    }2K N&F |[W C+J
D_J7T5D2[,lP
function moveBall() {
W'mOW1P%|0q5V e    if (superballRunning == true) {
KA }"uh       calculatePosition();
|&TXg4IG(F:V       if (document.all) {o+e5q.z}%Q
         document.all("supertext").style.left = xPos + document.body.scrollLeft;6D&u;Ny;["`!t
         document.all("supertext").style.top = yPos + document.body.scrollTop;
0e{sz ^+Z          }O3j$z$F6V_I)C
      else if (document.layers) {&k-j5{:O7?T
         document.layers["supertext"].left = xPos + pageXOffset;
P7f4T7T7x          document.layers["supertext"].top = yPos + pageYOffset;
&epV#d$Z)r6v          }Adt,?Ljc
      animatetext=setTimeout('moveBall()',20);
:qI#N*f g/GiM5\+vV       }
4F4MO5Wr8v u    }7p"o2pc(hb$?P

MvP D` function calculatePosition() {
~)b"H8T0uS/l[    if (xDir == "right") {
EH H Sr}       if (xPos > (xMax - contentWidth - BallSpeed)) {l _ og6rai
         xDir = "left";
,J&CG.S+p.|"oB U]          }#@ ZOy!q9q&M;A9^
      }
'p&R5m`K Ov?c&p    else if (xDir == "left") {G[7tx%J/z}!w
      if (xPos < (0 + BallSpeed)) {;Y+Vv#?v0FV+f$H
         xDir = "right";f9Tv)d$y0W!UG
         }
i3F-Hd$lk rU       }
)N:m'Ry?*i    if (yDir == "down") {f}n2b K3A9Z
      if (yPos > (yMax - contentHeight - BallSpeed)) {J;]:_'hE
         yDir = "up";
z eQ uc+I1a          }
'`LB Rn2H       }
Az0C3Ec%O-i    else if (yDir == "up") {TyMsY4wiM
      if (yPos < (0 + BallSpeed)) { R;n9{~:G/Y
         yDir = "down";
-\W^8N v          }"tvB8N4n'L6Cn~ `+y
      })nr"N4t?x*[\
   if (xDir == "right") {
"r[O1P FXU8A       xPos = xPos + BallSpeed;
`X5F,o \C9r       }[Q(Q UIr_y5B5G
   else if (xDir == "left") {
9q.a A:V R"Jk8|!oa'Y       xPos = xPos - BallSpeed;9RG!lx#u v'zI9ce
      }vx-Ss;[9_[4`C.t
   else {
-}?mQ|POb%{       xPos = xPos;
P[0A#z8I7`/W0X       }
T F~Ae(a    if (yDir == "down") {&p9u[7Rr ]p8ve
      yPos = yPos + BallSpeed;M^I Fs[v2I'k/P
      }6Z {'M;h+w
   else if (yDir == "up") {
q){z.C7_gip       yPos = yPos - BallSpeed;9o pCdCt
      }r/|tmA ZnB:Z
   else {
7D sk,Q"@6k'UAk9el       yPos = yPos;ir/q4u*wvc
      }Y/KO_ `{ XRW2F
   }J6Zg*gD8G
0XfcU#{C'n:x(~(O
function hidetext(){
*\f%bA? d7zVmq.[Fhi if (document.all)Y$g;G}'m1Po
supertext.style.visibility="hidden" QEZ&Hl;c7DnB
else if (document.layers)
*gC1C/c/fX"G document.supertext.visibility="hide"Zx%f2^6Jk
clearTimeout(animatetext)
_C*a BH }
wO \ Q\ ]%A SV!A
uL@fZo if (document.all||document.layers){9l7M6Wl^+\&D
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>'))h3g4X!\%r k-v1M
window.onload = initializeBall;
R4i2H sA E window.onresize = new Function("window.location.reload()");:Ll*f/h s}%I
}
F kn8\ J(J 2yU'quv
</script>

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


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