捌玖网络工作室's Archiver

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

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

<style type="text/css">
P,x e;j"vu #supertext {
wZvr*^,OXS position:absolute;9o9ev5Q"]@ l$s
left:0; E;B_t_
top:0;M ~4I1KUE H'`7l!h
visibility:hide;
HW,I_1R5V5lz visibility:hidden;
2]~*g5n/? xh,S \i }
6^zA5^a </style>EFYzD2m~1}
<script language="JavaScript1.2">
U+dmZeq5^ <!-- 改变下的字体的大小。颜色-->
i;lo9R&Bh:h#a var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'4H6e:X'u4c O C_PM
var hidetimer='';
K Fh(ug5L8}5[tWf <!-- 改变下的弹跳速度-->
}.@$mt] var BallSpeed = 20;
K:`P s-tg l/Q var contentWidth;hMy+]9Q
var contentHeight;
*WDV'O*rp"E$Ick var maxBallSpeed = 50;
1Eh2Jp-y[!C!h 6i@x'{4\u(rj

6kB-lm"? var xMax;(d_w$v,Mnx:o \K
var yMax;
aoos6ay j(`o0U var xPos = 0;
.^ls] L f3e&u a var yPos = 0;\)e x]k2v6U
var xDir = 'right';| `8SH2e6@K:Q
var yDir = 'down';
k!c4i"m"H var superballRunning = true;
;Q`8@C1yU2jX5X:Th var tempBallSpeed;
*d7~2O [Hvs var currentBallSrc;6NLS;uEO
var newXDir;P d(o5V!g
var newYDir;
1Km0v,m3_?0`k
Ew-n;fe%|)cN function initializeBall() { sgT5h|:JD:a`)T
   if (document.all) {^t.W `/BQ)U^
      xMax = document.body.clientWidth
5o0c.Kl7gF       yMax = document.body.clientHeight
YA$l/mk Y_"J'|       document.all("supertext").style.visibility = "visible";
uo-G w*Hn*VR hz       contentWidth=supertext.offsetWidth [^!O\0gtH7Ss-E
      contentHeight=supertext.offsetHeight0dP+[U9B]
      }
A/s v`7eK }1r+O6EU    else if (document.layers) {
6a/S)`ix7w       xMax = window.innerWidth;Z c1]x b mP)R
      yMax = window.innerHeight; JX(Enl3A|9ng,?3}b
      contentWidth=document.supertext.document.width
"Xv'@V]5k       contentHeight=document.supertext.document.height4{!LP5I.r2[
      document.layers["supertext"].visibility = "show";
3|%X4spW8D F o!Z8x       }
~4ia9U,e iEJ    setTimeout('moveBall()',400);
,A} q S!B@Y7h    if (hidetimer!='') }4rlc.jd9h
   setTimeout("hidetext()",hidetimer)
&k-[$b jVc$f_    }
-kS3IcrQ f5U2{ oq8l4K+c
function moveBall() {
,g!nq`9mUn;{K    if (superballRunning == true) {
oK(W l'}(N(P,W1I(N       calculatePosition();
y&A%\"U&hF       if (document.all) {@F.kf'Y)em
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
j;gI wi6hQGxF          document.all("supertext").style.top = yPos + document.body.scrollTop;
6?;f+^ h FQ rx/hjk          }
u8gW'e:X ^       else if (document.layers) { Sb/a3F2i*y
         document.layers["supertext"].left = xPos + pageXOffset;
UZ C%`I6v ?3W          document.layers["supertext"].top = yPos + pageYOffset;s3]\+Su }o
         }}l5}8G,I/b
      animatetext=setTimeout('moveBall()',20);J\E] o ]e$`
      }"AY*r-S?L
   }
)Z,Ir8q~8Q
snD,cB1G@@ function calculatePosition() {
s)p)p:W@k    if (xDir == "right") {^)[ j2P:Y'F
      if (xPos > (xMax - contentWidth - BallSpeed)) { [%l.Y Cs-z
         xDir = "left";4oHu2\0T5a\0~
         }Q$KElM c
      }tGJ.@4[/S}F%r$Z7F
   else if (xDir == "left") {
.wjU%\;PlT m       if (xPos < (0 + BallSpeed)) {,]0e!G)x M^0j
         xDir = "right";+Jt ~0u-Fz8W:y,G
         }
\(kC'B!~4\*N&Uw1[       }
T!ac*`%ry4V    if (yDir == "down") { dbl$[iT NE
      if (yPos > (yMax - contentHeight - BallSpeed)) {O am$\5X$q
         yDir = "up";|1]w;{*_ md&T
         }&VN?e$f hnGZ"D
      }
8}w V9@j    else if (yDir == "up") {
vQK s0})Y[3];`       if (yPos < (0 + BallSpeed)) {3~Lfj-h CQ:~4\
         yDir = "down"; gUA3GJsI#X
         }
[l,C T1|8T:Y@       }0X/W*? E!f["V n:Y NI
   if (xDir == "right") {
VrY%s,|zTF       xPos = xPos + BallSpeed;
P(^UJ?!x1v_#f       }Q"_ k0z,V
   else if (xDir == "left") {)w2u~.o'mPFgG-Q m
      xPos = xPos - BallSpeed;^6h3sn#q['?
      }-CT6KC9|,w+LA
   else {l`BfQu
      xPos = xPos;0P8k8O9P#X"HY oQ
      }
!|/@d*o1u%p/N-Czn    if (yDir == "down") {
@S@ Uk#EJ       yPos = yPos + BallSpeed;
@i6nd'd@Zn;C D       }
.]z,r$x\4T    else if (yDir == "up") {
eqK!AG       yPos = yPos - BallSpeed;
0tx+j$wW)~       }V{3V0T:{ |$^@U
   else {
$wE'm1I}~       yPos = yPos;VJ2g9o#dI
      }
p#WEi@-R.k `    }fqq2l'Ox:R9K9L
kGb#c,`?FM+Pp
function hidetext(){9e'd E~.L#O]
if (document.all)
}_2d6itGN }l'h)a supertext.style.visibility="hidden"5Q!jG:@4F a#t
else if (document.layers)Q8Z G:Z3GV~#yH
document.supertext.visibility="hide"P1zxRi2v[VL }
clearTimeout(animatetext)-A.g;C ax K~4`
}?Zbiw3JOesV
\G8t/|R9L
if (document.all||document.layers){
'c;X~ K*S/?F{ document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')gg/j,Y5y k8xM
window.onload = initializeBall;
n_(W1K h%e+jX window.onresize = new Function("window.location.reload()");
A4qQ*Hrc }
X Z \-P.m8WUt(b` *yr)v2qk(@ O
</script>

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


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