捌玖网络工作室's Archiver

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

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

<style type="text/css">B$p L7C2R&VW i
#supertext {
hS9HgqK position:absolute;+Or[5`L/k?
left:0; z1j]{{HL'LE$S
top:0;,Q5C:`\9F E9KLd1Um
visibility:hide;
U*c/\ R p'z1b visibility:hidden;
o+Y2}Y7S u1? }Q"dZytp,DY
</style>
/U SLH ZQ(}:}} <script language="JavaScript1.2">@};\)h9f&_
<!-- 改变下的字体的大小。颜色-->4dq1iF7@7q%aY/Uf
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'7}2V)ip(cD%`
var hidetimer=''; _n |2~BQ
<!-- 改变下的弹跳速度-->
l"@N+~'y0uR var BallSpeed = 20;
'l/^4F;Jt5h%^d.} var contentWidth;]'E&Q1m/cFB
var contentHeight;5Cj1K/g yU8@
var maxBallSpeed = 50;
E] {g$A? `$gM/E u5j Y U N{bTz)CG2g'v}
O3nQ-^1p
var xMax;
_g9HZ M var yMax; O'w`![ v R|@ g5g7s
var xPos = 0;.TM.XA;z;`cb5o
var yPos = 0;
IQJ"h ^H var xDir = 'right';
0R*mj V B[VL+?^ var yDir = 'down';"lO7hX+{_Q0a+Il
var superballRunning = true;
3^-n2teVi| var tempBallSpeed;^5F XgA l
var currentBallSrc;
x;h Xcm\ var newXDir;
roLb&fP ] F] var newYDir;b)f2j3X3q

%`+DaBGr'pa m,w'J*SN function initializeBall() {
vt8sE_ dg5N|d    if (document.all) {
4R4^Q-G7{3N       xMax = document.body.clientWidth \ea2j c)N*m
      yMax = document.body.clientHeightj;Q%qMs q-jxZ
      document.all("supertext").style.visibility = "visible";gQx!{#e)A-k2x
      contentWidth=supertext.offsetWidth IW G?6g,m
      contentHeight=supertext.offsetHeight/tx k#FWWpV
      }
qf{{Q+az(G7l'k    else if (document.layers) {+\3H%p&K2sKwz'|;k
      xMax = window.innerWidth;)x4\'~4EpX@&?0W
      yMax = window.innerHeight;
*c&b|UL,r*\       contentWidth=document.supertext.document.width
d5@7f0i2]:c?R"b#{       contentHeight=document.supertext.document.height
N i$m3c2KqUr?t"v       document.layers["supertext"].visibility = "show";
FXt,T&WV       }
!Q.[6o/b!i&Q)ewkC    setTimeout('moveBall()',400); b`4C(t[ Db
   if (hidetimer!='')
h9~s#tW    setTimeout("hidetext()",hidetimer) QAl:K fST*HO:Y
   }
wZM'Y%~Hfi_9v
9@f-g8WO!Cl function moveBall() {
s8C7O&ESzu'Vr&Q    if (superballRunning == true) {"`go\ cr'] w5`
      calculatePosition();
Jp,ts'c4X       if (document.all) {
3o9g2iWg          document.all("supertext").style.left = xPos + document.body.scrollLeft;
;g~I$d(W&R~Em*|          document.all("supertext").style.top = yPos + document.body.scrollTop;$^M} ?&Bug.l
         }
3@yY,DV4j2Do4W       else if (document.layers) {
|'xK/RQ!xY Z[          document.layers["supertext"].left = xPos + pageXOffset;
J$?u2p%]} BM          document.layers["supertext"].top = yPos + pageYOffset;
*uYFEu6}8n#n[5a          }
k DM.r7?&S9E       animatetext=setTimeout('moveBall()',20);
/I.Utw"HJ       }
{t)|/s,x+OZ ^6M K    }
m}Y^4SL?
;@Z*\`M2w JQi function calculatePosition() {0xR;e Y7E
   if (xDir == "right") {
A.b6s6w't"uA a6{       if (xPos > (xMax - contentWidth - BallSpeed)) {A9b2TjXL|
         xDir = "left";
]F;]/r#YrM:l          }}U!UXJJot[
      }ZH]VSwJy!zO6v
   else if (xDir == "left") {v!Y1Fm9Y
      if (xPos < (0 + BallSpeed)) {
7R9zPzI          xDir = "right";-[.v9ke&n?&@/`
         }
-b7Co4or4i D       }
3RD%Of9]i&Edj    if (yDir == "down") {W7PX?hF#a
      if (yPos > (yMax - contentHeight - BallSpeed)) {
0c1l xOxB          yDir = "up";
.ori8Z lT!TV          }$KT\%H%b]m
      }
2d3SS jd c'hf.h.{    else if (yDir == "up") {5Z;qS-f u?)Z g
      if (yPos < (0 + BallSpeed)) { Y(}ok6b/EMs
         yDir = "down";1f BRKV"tI6~z vU
         }
h/H#lr.~       }4Q{X.V,@'y|#D
   if (xDir == "right") {
r(rT XG8SLx       xPos = xPos + BallSpeed; t&t"D[!W(YSTIZ
      }1V:g I2Y&Y
   else if (xDir == "left") {
4`&zmR,C} N"]       xPos = xPos - BallSpeed;S3|9I%Nr@x8K
      }
]+b#A;xI*l'Y    else {
V*gSJ w6_       xPos = xPos;
wu%t-{-O7m5e1` C9Y       },Rf0{-G[^ W+V0p
   if (yDir == "down") {2cyJ~3P
      yPos = yPos + BallSpeed;L7gWM Lu
      }
+G)^;TP(RD;DPHT    else if (yDir == "up") {b4JlB#O6ow%Y
      yPos = yPos - BallSpeed;
(dDM:|3g4GOy]       }
OIc[hM'H(?Y    else {
6{\IXf[       yPos = yPos;)^P6U#i6c7Y F!n A"sv
      }
+}V7C(y pZ M|SY    }
"W!eg2c9_:P(w'y
%h}W0pS`G`NkI function hidetext(){
;{Kj;e:s1?GQa if (document.all)
aLU&|-l E supertext.style.visibility="hidden"-mhneF jNy
else if (document.layers)I0R i&z?#O
document.supertext.visibility="hide"m s ^.L|`*x@
clearTimeout(animatetext)Gq)[Y9a L
}
Upc)~d4HmL
/gFpG] if (document.all||document.layers){
WO]H| document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')/y[6P2v;fS'}7Et
window.onload = initializeBall;s#}$A;f&q.@w&j5g
window.onresize = new Function("window.location.reload()");nx2f;j7nT%h
}3^J7A2|WY Cc C^4^
_4H9SyH,]'Y6\ I
</script>

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


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