捌玖网络工作室's Archiver

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

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

<style type="text/css">2gP,T dH}
#supertext { EH7w7D |S s`
position:absolute;+W$dWpj4c9aD"e
left:0;
,u5S]|B,_d|/{d top:0;
7Qy:i8m_B\"p visibility:hide;g)iuT]
visibility:hidden;3ZG8{N J7p9os&E
}
wKsD)T%eS </style>\,ZqH6~V/w,O S.{
<script language="JavaScript1.2">l/v:MS)k a8u N'jr
<!-- 改变下的字体的大小。颜色-->
gH!u&A0wzq{ var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'v.UH^kUd
var hidetimer='';
7U#hmO\ Z,C!n <!-- 改变下的弹跳速度-->;wV']k1W7Pq
var BallSpeed = 20;
$f2_I8b/dP K b var contentWidth;
S+^Qh+Y'O4hu*lu var contentHeight;
C Q,rCTM,o2k var maxBallSpeed = 50;aYZWCq

_ I9O~IH
9J3D4rt9X_P.m var xMax;7`8~`]amaN!N
var yMax;$V5Q{(p(r
var xPos = 0;
~r;lRv1HrO var yPos = 0;
8m{vq!F var xDir = 'right';
!_} D5h%j2ZE3Gx!{ var yDir = 'down';
$l+? |!X,H)qZ _f var superballRunning = true;Skt fh$Y
var tempBallSpeed;1jXpLV5tV
var currentBallSrc;
6w.mu.n4a.c$d)A var newXDir;'v%SDKX$|
var newYDir;
.b]9k;y7\&T&@a m^ p%KyJ{0Bd
function initializeBall() {t o2@l3g-_/xE
   if (document.all) {3`A1O JY'?
      xMax = document.body.clientWidth
/U,V*F/{t6~       yMax = document.body.clientHeight yg?m-j `4b ^c
      document.all("supertext").style.visibility = "visible";{-Vz$oZ0|
      contentWidth=supertext.offsetWidth:MH6O"Gu'mZ7X p
      contentHeight=supertext.offsetHeightu%D3v2v+]5X(c
      }%j X2hI:m2f4D6V
   else if (document.layers) {
-u0a S Le]7x       xMax = window.innerWidth;U\h'J^!K#A
      yMax = window.innerHeight;
Q d euk3_ gux|       contentWidth=document.supertext.document.width$cu6D!O6pbb]
      contentHeight=document.supertext.document.height
&_cj7L4ShAEH       document.layers["supertext"].visibility = "show";
t}3C0}A!Y#_T       }
$`%D6ty)bD9b@#WtNM    setTimeout('moveBall()',400);
fbP5r1` b    if (hidetimer!='')v b{5jV3Q-]S9N
   setTimeout("hidetext()",hidetimer)s'dH"j,]
   }a"R4eTHKOM B
.D0C$\P~,|/a
function moveBall() {
RH$?0}"Xz@J6u    if (superballRunning == true) {
+n'[H*k+h4}       calculatePosition();
O,}N]}6A(j Rj       if (document.all) {1br u[ CT5A
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
,e`pW qH~#xj          document.all("supertext").style.top = yPos + document.body.scrollTop;;F6Hk#asa`C3R)}"_
         }%IT2t^YMnt
      else if (document.layers) {0Qx-^"?'l:By
         document.layers["supertext"].left = xPos + pageXOffset;
;f%]!Z ~E9i,lf+k          document.layers["supertext"].top = yPos + pageYOffset;,W!x8S"n\y
         }
o/W-R{U8I2w8]0aL       animatetext=setTimeout('moveBall()',20);
&rRb3\;tG$a`       }
XSZz4]efV    }w;InmqA)od
#u SU8W o s0T~F7m
function calculatePosition() {!O Y9V [-c:S
   if (xDir == "right") {Z |UN yCp)p;J;bZ,e
      if (xPos > (xMax - contentWidth - BallSpeed)) {3E]R8X/Ep3E;k
         xDir = "left";wb$~\$[ F1V-d7I
         }
\@I Z(cb0V,Dei       }7Px%J.czP(cT\
   else if (xDir == "left") {$?#R\\W!U$b
      if (xPos < (0 + BallSpeed)) {
h8f Yj)g'a&V          xDir = "right";;[4i/mq5d%KB
         }
;D9D _v.Y%Eb(g       }E3GM0q8O0H'q
   if (yDir == "down") {
3el,gHQ'vW+\       if (yPos > (yMax - contentHeight - BallSpeed)) {
Es.O C'VWx          yDir = "up";
~xfDY'|9|h          },wE.D)r? U'y9r|Tw%e7f
      }OiQi4`c
   else if (yDir == "up") {
)C"x6B/W#_'?       if (yPos < (0 + BallSpeed)) {M(QY{U&y
         yDir = "down";n,n Ch0}R
         }\:CQJmW%_
      }
Zy+p;{bci$C    if (xDir == "right") {$~)FUT4} v h@6[
      xPos = xPos + BallSpeed;`'ga8Jrh ME%^t%g
      }*vw*W8sK,PZ b)~ o
   else if (xDir == "left") {e+`Z.kP'WwKhC
      xPos = xPos - BallSpeed;ZM$E#^4T1tB.gF
      }1a.y,W8`W yo }-bG
   else {
+P~6|!~F5K       xPos = xPos;3hP F Z^
      }AA3g7Z`?
   if (yDir == "down") {
nE-LG+?;Q?       yPos = yPos + BallSpeed;Qo.{[d2@#[*U#T
      }s3Z.b.ww[,G o*Q
   else if (yDir == "up") {
m:t]|WUs       yPos = yPos - BallSpeed;w6A*f8A9OU5@J(B
      }c(@sqx(u WF
   else {"LA&Z o;\E j:I
      yPos = yPos;.x&V:D+H:]O+L Zz
      };_u ]` Q w#j
   }
?Y7_+@'p'M6IFz6R3w
7M-m'NAP&i!~!x function hidetext(){,]eU,K\#HE EB b{Qg
if (document.all)
(R%Q8KO7v supertext.style.visibility="hidden"t6L-~a pdo-D,s x
else if (document.layers)#Z7Ls^;X m
document.supertext.visibility="hide"
A.X%M z)A:f ~ X clearTimeout(animatetext).y O-r(R*O8`r}'`
}
OBR8| I/XwM%g
B!q6`V Y? if (document.all||document.layers){
}p'SZ`*?_3V document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
I$V,DR&s5s9nB window.onload = initializeBall;
}B1dh3DcD window.onresize = new Function("window.location.reload()");7L!v|9KU D.f/n
}
JE:s l:I(ob hK&OFO3G @6g
</script>

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


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