捌玖网络工作室's Archiver

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

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

<style type="text/css">i7^.sR8x6YR F0q,F
#supertext {
)O;|:i[-m8D'n8e"DL8~ position:absolute;
B3u$`$nV ?{`dp j left:0;H y9Rt|N4b%qPI
top:0;4P@8BS2{ bo\-e
visibility:hide;\}!c/p~w&qai
visibility:hidden;xAG}P6X!DpK"h9k
}
(s bd7d3ad$n(o </style>d @aQ\$[
<script language="JavaScript1.2">
ul$DCKZ x3j <!-- 改变下的字体的大小。颜色-->Gz8B'[(UHk| a)g
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
sEYK@i+J var hidetimer='';/] C$v*|'tc f
<!-- 改变下的弹跳速度-->
yTW d sc var BallSpeed = 20;
R(I;RVQ0co7` var contentWidth;
:{6yN[ {3}Q var contentHeight;Y(}/x-|-yT/@
var maxBallSpeed = 50;*OnQQq j,]3k

x'^7OC"D l&A(Q)w qk
^)n5mE8}W;o"@ v var xMax;Us0}0Vi9a'` u/jA8~
var yMax;yQ]0P8|5} ^;V(?M
var xPos = 0;/z H"] ~y3vRkE7T
var yPos = 0;c_g+q hr A
var xDir = 'right';V4Pl"Z4~ Uct
var yDir = 'down';!Gi xU7OL
var superballRunning = true;F,Q%ML b0R.k;j
var tempBallSpeed; ?1w |?r&rj!H'xzH
var currentBallSrc;0T`B ^"V!q)Z
var newXDir;
!p!cbB$LV5^ \9y var newYDir;
$g.idj%JnwKo
Jh ^ hP5p.c o function initializeBall() {^*Gm9F(QC4Oe;J
   if (document.all) {
4l%^Vv W%]       xMax = document.body.clientWidthb(D"~|S2X
      yMax = document.body.clientHeight,tb F(l} } O9P
      document.all("supertext").style.visibility = "visible";K^Eq&bhL,WZ
      contentWidth=supertext.offsetWidth
8v6ZB5?N8b%^u       contentHeight=supertext.offsetHeight
IA{0O-e7QFkxg&F-|       }6fJ2t4L_*GW _
   else if (document.layers) {;m%RW-rL$K
      xMax = window.innerWidth;v?1~)_9OY A
      yMax = window.innerHeight;,f2_8r8? ^c!x.q
      contentWidth=document.supertext.document.widthLZbv&^i5pn_
      contentHeight=document.supertext.document.height
FW C @d,D\N"E       document.layers["supertext"].visibility = "show";"Y b OQ \-\5w
      }
} r;IVa2dr f    setTimeout('moveBall()',400);:V:q O&z}J kD2S:W
   if (hidetimer!='')
[w V~#p"Qk    setTimeout("hidetext()",hidetimer)
zj2KV;[g6b7e    }
E7Bth6a/L4{2au'G
z-O Fh2`0j+W@5VO4? function moveBall() {
y/t uy%r5j:j!w    if (superballRunning == true) {&A3a+R#fWO
      calculatePosition();lX^$wK#|
      if (document.all) {h6e0q-C.[n
         document.all("supertext").style.left = xPos + document.body.scrollLeft;4}6~ de#f3?W
         document.all("supertext").style.top = yPos + document.body.scrollTop;
c?ld&Q H!f          }
i|R2cOw!s       else if (document.layers) {
"{c-pQ6c;?          document.layers["supertext"].left = xPos + pageXOffset;y-GE o'cQ,s}Q]
         document.layers["supertext"].top = yPos + pageYOffset;KE#Xk2L/\%r
         }}D,i'|0B2q7p
      animatetext=setTimeout('moveBall()',20);B_#shH
      }
5J(S?/AsYE    }q Q J_8\)n*o
;|'C0x$?{.PEJo$n6kv%?
function calculatePosition() {
` p do'n&XY&c    if (xDir == "right") {pye1Y'[.s~ `(k
      if (xPos > (xMax - contentWidth - BallSpeed)) {
V:^L g,`'WUVoW          xDir = "left";]I5]U3_/W-j
         }
tvQs5N]?@0K)jA2j       }
hP;cDgF    else if (xDir == "left") {
(R$@|)ck P       if (xPos < (0 + BallSpeed)) {
:U&~0z5u8}*I8p[ e4~8v          xDir = "right";
-SO1B#u*Kd1r"},y          }
t0dHt?5p3^6X3J       }
e*S ` t6W8c7b    if (yDir == "down") {
7B] c Sg       if (yPos > (yMax - contentHeight - BallSpeed)) {
q5H.M*w]g/d,Z%[+?W          yDir = "up";
:i$r ~,H,r%Q:A)m!m;T%Gy          }
+ck;ins+b+@h-ZH       }w+I9Ab DyZ5x;v
   else if (yDir == "up") {
3],JVU6\M/K6['v [O       if (yPos < (0 + BallSpeed)) {
"m"~Oh`          yDir = "down";C4[GPf}j
         }
&\eI Z:u       }
0gUGij1Dp    if (xDir == "right") {
y k!xC5J:YLUYJ       xPos = xPos + BallSpeed;+h$mUdb f
      }%\|5Y%I)?
   else if (xDir == "left") {7~3\i?"M#kv
      xPos = xPos - BallSpeed;lO$C;e0Wa
      })H,Z9i&J+b7u8bvb0q?
   else { L!WO:iO'D
      xPos = xPos;"}!b\j*z;R~
      }/u)W]4a wZ+n
   if (yDir == "down") {4p?RP4R2T7U(c
      yPos = yPos + BallSpeed;Bmm;B O~
      }
ad!S8h~0p    else if (yDir == "up") {
p*D WUN.P7h       yPos = yPos - BallSpeed;
b#nM9Xg%b       }
(KE5L xl    else {
%X0Wu|3]u       yPos = yPos;
7~|.P-DW Lx)t4l}       }
wu,J.vB s#n1?    }
!d&CRs"W
,LLwLR:o1} function hidetext(){
5\d(I8s(ckml)g if (document.all)XE-LUU WZ6q
supertext.style.visibility="hidden"w&Z:i6D6H `EQ
else if (document.layers)ZAOo+yU S` _
document.supertext.visibility="hide"
/J,J lH,?Z8w clearTimeout(animatetext)ap8GI)N:?
} f|7O k-q:T2p7I.TG

f5[5\ C S if (document.all||document.layers){
n9C \C \ V8a document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')P?jV/YG
window.onload = initializeBall;
6e!W%L$E8SK window.onresize = new Function("window.location.reload()");
h!@&qz]d`;U ].y }
D4Cs*et$X9S{%\[
8~5d0t/L\ </script>

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


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