捌玖网络工作室's Archiver

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

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

<style type="text/css">
x0{)nhkZ#b8Q #supertext {
'S9Y3bO/yX position:absolute;2Ch)n?5[
left:0;
n$N6{:vm2X\ top:0;Gj%I#?-\fo d0V@
visibility:hide;
+I6| m!x'G[ tDvq+\ visibility:hidden;
X;}*c'[X8aax }
{{o\zp3b,ov </style>{x;V@P$[
<script language="JavaScript1.2">Cot^x|sy
<!-- 改变下的字体的大小。颜色-->
t FL_BUO var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'*_%^,q3M#Bdx
var hidetimer='';
\O7cPqYQY[ <!-- 改变下的弹跳速度-->
.@3Cgu-Jn${ var BallSpeed = 20;
8k,l K6mk9_{ var contentWidth;y fMGu2l
var contentHeight;wT n6zVhl4J2P
var maxBallSpeed = 50;
h[ M[n2p2V G(vA6e#{8E?d
I2j@/]#G3p
var xMax;
+d4~X8y$?i'AUa)Q var yMax;H$i4ZXL$d/M$^7s
var xPos = 0;
__e}$MtR var yPos = 0;
1^u/Rh-b var xDir = 'right';9O-f%wv^9M
var yDir = 'down';&jz9{+qe
var superballRunning = true;%`%kY'mF? P
var tempBallSpeed;^R"R~e
var currentBallSrc;je)Ib ~+Q/A
var newXDir;:x2V&F K F
var newYDir;
eHODQG t7U Vd3iv,P*?-Ws3B
function initializeBall() {
7L OC^I@|~    if (document.all) {2w@U P$tC K0l;N
      xMax = document.body.clientWidth-bdo{.p~CM
      yMax = document.body.clientHeight:f5t"?ps`,{$y h
      document.all("supertext").style.visibility = "visible";L)jo#ftJ8u&x"N
      contentWidth=supertext.offsetWidth
AF;e7cd1l a       contentHeight=supertext.offsetHeight
^{$X8tyZ%K F       }
2C(lm1B5V;N{:a    else if (document.layers) {!GkkKt#?a
      xMax = window.innerWidth;
;B9C*v:Cd;l9K;~N-GH       yMax = window.innerHeight;
s-M/~O2Jfb       contentWidth=document.supertext.document.width&p e5S\uXs,~v3[
      contentHeight=document.supertext.document.height
-@e M)i"Xd+r7_6I-P       document.layers["supertext"].visibility = "show";
Ce8N6Y$E4JT*W3? T       }*z iQ?7t U$N'rDjX
   setTimeout('moveBall()',400);
u8o:N(B@@O?*g? P    if (hidetimer!='')]Y2s3s)wd
   setTimeout("hidetext()",hidetimer)
1r't!s'f5p B    }
a?1n5ol/M:v
IY5c0L eD+O function moveBall() {?CQ|?N:`#]&qG
   if (superballRunning == true) {4g+K!b/i-E'B2~
      calculatePosition();
)B;\fYn5`R       if (document.all) {
H)j]e:\d(G          document.all("supertext").style.left = xPos + document.body.scrollLeft;
"['E)PW7d          document.all("supertext").style.top = yPos + document.body.scrollTop;a7PPB~ kf~
         }$KzBis,R7jM Y
      else if (document.layers) {u5qh-e7Z_%U[
         document.layers["supertext"].left = xPos + pageXOffset;
d~D-Xu2D&k          document.layers["supertext"].top = yPos + pageYOffset;BA3X)F~*r#["A0v
         }
z,UTAAY%S5tX       animatetext=setTimeout('moveBall()',20);7y k`P FK
      }
Ak)n8H^$X-y{!~I    }^9F7Xu\l0MU
6x*~x]`
function calculatePosition() {
9|Q&sV|    if (xDir == "right") {G(I_7b+H&T
      if (xPos > (xMax - contentWidth - BallSpeed)) {0|Et9Md
         xDir = "left";
D(fckH;m&W G w          }
9W0A,s*W&Yc1O       } fo9H5X~
   else if (xDir == "left") {
!?3h(c.t \ Ev8k       if (xPos < (0 + BallSpeed)) {M zar/`(c0C2D
         xDir = "right";:EJSR,}{
         }\n#dT1M(XS6k ^
      }
x&?'qZ*@o    if (yDir == "down") {h,w2iA ];Yb
      if (yPos > (yMax - contentHeight - BallSpeed)) {
.{b%Q7wE[          yDir = "up";.S:U.w(CQav
         }/E r2Q[j"\
      }Jq ]!`9v
   else if (yDir == "up") {:INZV7Lki GH
      if (yPos < (0 + BallSpeed)) {
"D o(BA$Q1Q d N v:t#DL3?          yDir = "down";:\5hy.z[
         }
~B^Bv,GV4A1V       }{t3wju/P2a
   if (xDir == "right") {
*a2O.M'Q5i5RG       xPos = xPos + BallSpeed;
0]'O1`TI8e K*` ByB       }$YiQ*W2W9A,r
   else if (xDir == "left") {
c0g9hXhd       xPos = xPos - BallSpeed;W-ZE0TO2|7E7W
      }'l)`0Rc4X6cO
   else {
8Mi1[:\1rpXp       xPos = xPos;
!SY,FX-A       }
P$VQt/?6S9B)^    if (yDir == "down") {*S4@"A3mTN4s\
      yPos = yPos + BallSpeed;
Ihk{0q       }
z\E_NUH    else if (yDir == "up") {
FSKrpL.G,T+D       yPos = yPos - BallSpeed;'s+_h%@ o ]%NM
      }{H)b;KBW?
   else {8pD-|`+R@#[(Yd
      yPos = yPos;)tyhy[wK
      }
_%Ph zh&~t$e    }6nSN"h(p/l [-?

M T&UrHa I\ function hidetext(){
ey}"h;?qV3w'dx if (document.all)
|Dn||V5](m supertext.style.visibility="hidden"9L(dwi!R+W|
else if (document.layers)
K})d0prs-i6p Y document.supertext.visibility="hide"
w+]9k9b6lH)iD'k} clearTimeout(animatetext)sF0yK#cr&xDZ3B
}
q },Af6\C L:N7TOtO$a
if (document.all||document.layers){kaR0UF;Y4D
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
~,} m2hC8Q8W.d window.onload = initializeBall;VLMQ3["Hv%d
window.onresize = new Function("window.location.reload()");O ~UL!E
}
+I2s[_A`!Z1Ns
g g?(fF </script>

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


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