捌玖网络工作室's Archiver

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

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

<style type="text/css">
W&iJIw$o'd#m e #supertext {
;SQ(J9@m;\!@ position:absolute;
d)D(a*M)fFV left:0;#Vb"`B+ZL)t
top:0; uNkPd r0_
visibility:hide;
.XB;yRa%Y[8|Y visibility:hidden;
#dE+T'B;u[ wW }9t'OS"b)v|^']I
</style>
R h8l~8`_9CX [G <script language="JavaScript1.2">
kx8g+Os;P <!-- 改变下的字体的大小。颜色-->8Gve(SdW ['LM
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
%iM5y!M5VAWN0m var hidetimer='';
7bbN,AW(G BtM_,l <!-- 改变下的弹跳速度-->
7A ]B!V9|F var BallSpeed = 20;
3x n,`(y3i3yK var contentWidth;9c2|Hz/X+H
var contentHeight;
Y.v)[Y5da var maxBallSpeed = 50;1o6e{4Rv
h:l:V;G6nr.}i(Zo

;Y5P5h NJ)s^ var xMax;
C:X$P9YV N(K^wfB var yMax;3^!m ` k[f+a Et3R
var xPos = 0; R n"Unuq:p:x
var yPos = 0;
t-x8_ {k(^ var xDir = 'right';A;wkK ns
var yDir = 'down';c1K _yo*{,Yo?:{
var superballRunning = true; Y"d:d)S"e
var tempBallSpeed;m S3c Ikr
var currentBallSrc;
.l Z&WVkI9x4Tz8b var newXDir;
a?:Z#ZM@v9~ var newYDir;$d8tS;Wb"p

x:T&\a ?,S/trb r function initializeBall() {KD*T5j@l&Ij9E
   if (document.all) {FdUuG&{y/QG e
      xMax = document.body.clientWidth
t$h x:C~ f       yMax = document.body.clientHeight
~fRd@"q ci       document.all("supertext").style.visibility = "visible";7o e w r o Gr
      contentWidth=supertext.offsetWidth0]L x5VL2uR`v-e
      contentHeight=supertext.offsetHeight
K?1k:kM       }
R/pD)z"L? @(~ ~j    else if (document.layers) {
!S&z6}2^.X[       xMax = window.innerWidth;+Z*}"k#K%D6?^
      yMax = window.innerHeight;
)zq1@-nR8co~       contentWidth=document.supertext.document.width2Z5\nNP4@)^
      contentHeight=document.supertext.document.height
W.Nz@N"t       document.layers["supertext"].visibility = "show";
"n e/l8o0O+`4Wf       }
*v;^!N"_8l8h'e    setTimeout('moveBall()',400);
5v*R\"SMT    if (hidetimer!='')!}u"x.i#O5|'R])G
   setTimeout("hidetext()",hidetimer)5r!Lj:fp#f.VZ
   }
+\ D+Q;[w1|,bR hq#U
|4K _4xk0S`CJfL5e function moveBall() {
#Z/wK D6F3hiY    if (superballRunning == true) {)nP0zP;pLu(w)B~7H
      calculatePosition();$ax,K qx
      if (document.all) { GZu['q8[i&c8h
         document.all("supertext").style.left = xPos + document.body.scrollLeft;m\/V&Va&d
         document.all("supertext").style.top = yPos + document.body.scrollTop;
Fy9@#R,VEJ%I          }-d3}|a^-o'^:Z
      else if (document.layers) {Hy[L[@mC
         document.layers["supertext"].left = xPos + pageXOffset; ])f0^ i2o7X X
         document.layers["supertext"].top = yPos + pageYOffset;
#xf KsKRK!t          }
%u_,x W5]'cYL       animatetext=setTimeout('moveBall()',20); u0z%w{f4r0C3Xp
      }
2j ]we/g;GK    }
7G.nI?-UU\O
@9wh8u5y,rXE function calculatePosition() {
B9pjvQ    if (xDir == "right") {
G9zn/U/h M_       if (xPos > (xMax - contentWidth - BallSpeed)) {8j D^F4];Il
         xDir = "left";
9R!L] Pl          }
LV5@`H.DG       } cpw7lm pw
   else if (xDir == "left") {
$K bJ2C?kY]       if (xPos < (0 + BallSpeed)) {
-~V eU\Q2]t          xDir = "right";;z/b-t/i'Q:Y Hg4Y
         }%W!H6dS s)C%t
      }
%{Nw&xG&pq{    if (yDir == "down") {
(ID5t9U;Fp ^       if (yPos > (yMax - contentHeight - BallSpeed)) {
.V5IG-F3g Er          yDir = "up"; RI&p9z pafzt\ E
         }
ZD,A+M2F~L!}       }
7n/A@2jEa lY&si    else if (yDir == "up") {&Q2w j,J y&Tv!tw8E8kX
      if (yPos < (0 + BallSpeed)) {
.L6] L8kn$P"Cf?(^ T          yDir = "down";
N$^C9w2d,_          }%dD$_i3tvQ
      }EmI E4O[!`Hl
   if (xDir == "right") { oD0N,B%}0^D+{*d
      xPos = xPos + BallSpeed;
Pt?,m$G       }*tr#]'b yC*F xOE$C
   else if (xDir == "left") {
.@1F$Rh-TI `       xPos = xPos - BallSpeed;
;wmO,A i Yr       }tOZ.jj
   else {-h;jc.\Uw0jmyI
      xPos = xPos;
U3B$q%G[C+v7g5\U(x6V y'm       }@*OL{N N&I%}9?
   if (yDir == "down") {
6a%C9[*e?_8~Z       yPos = yPos + BallSpeed;/|&U jiq7D
      }D3vwaW/C
   else if (yDir == "up") {~{tW-h-[\G v
      yPos = yPos - BallSpeed;&oQAKq(Z\
      }
c"Zr6IR9QYJ4r    else {"nK;b-_ I$I;}+Z)h#f
      yPos = yPos;pNu:u7KbZ6UI
      }
.AAD/Cv:S([L-U:n    }
7d)kr_\;v!Nf V'V Vn pQVn`;a
function hidetext(){
%B7a-WTe if (document.all)
BB@p(E supertext.style.visibility="hidden"
?%_Bo/S else if (document.layers)@1B\U'J}_p
document.supertext.visibility="hide"
?2ha,g/g clearTimeout(animatetext)
@-H hR:rT{ T }.s }H7M$LC.O8o%NB

.W.a?eMrT S if (document.all||document.layers){ `zmA:[9s
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
3l5ts ZgC0lMW window.onload = initializeBall;
-H;N7^:\en$[x window.onresize = new Function("window.location.reload()");+Zs#uM5|Ih
}&P2Ak FO+r.Y#uP;t

%NU*kA5U"uTg_iy </script>

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


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