捌玖网络工作室's Archiver

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

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

<style type="text/css">@@Lt L;x]kh'e
#supertext {[@ez\`g
position:absolute;2PwX(^GI
left:0;s*fg9v.h8z2iF5m
top:0;B?#J/^I%`p'Q9D d#f
visibility:hide;
T^)_`g%F visibility:hidden;
O)TH#U^h7w }
;} S&^Xza j Ll </style>7zgPB/F/N8Eh
<script language="JavaScript1.2">
2d(W*zJ!|E9ua)KE <!-- 改变下的字体的大小。颜色-->-^V+oK r {H[
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'%@t"g6LxXn{8}
var hidetimer='';8Bm(T1Ku@
<!-- 改变下的弹跳速度-->
[&A[Wvd E:a)i var BallSpeed = 20;
1]bS$|T var contentWidth;]/W3c;Zv*g
var contentHeight;
;F(B}3gt&g2[6q&|Sg var maxBallSpeed = 50;)dxd1y Q.L
/E%{+K9{ a\
c5r*Mj9`!V
var xMax;6Ka(p%o1M6aE
var yMax;$N2}/@ wc-e-YK
var xPos = 0;-C3@'F f9u/N?0t%F ~
var yPos = 0;
? RD ]-|z^ N var xDir = 'right';
qqYt%W3in M*T8s var yDir = 'down';O!HBiFh3Q.f
var superballRunning = true;2@ Rc-I3jj4m
var tempBallSpeed;$kjhoi^ d;|'t
var currentBallSrc;
+G0u/QaSt:G ^U.n var newXDir;2W,B#\ \6{
var newYDir;
1Yb hFse a V9qf~/Y(@K Z-f l
function initializeBall() {w`1B{"Y1bo-ay|(jG
   if (document.all) {
L%yyP(G7I       xMax = document.body.clientWidth B3l:_9Qu Fx\ o+WI
      yMax = document.body.clientHeightJ rW2A(i |4~C sm
      document.all("supertext").style.visibility = "visible";p3~.\l*V
      contentWidth=supertext.offsetWidth4{1awZ;kiO"y
      contentHeight=supertext.offsetHeight!C`M4b3[A'k
      } i5Ko]{NSe0A }nO
   else if (document.layers) {
)U^ eZ#`&~DF6q)C D       xMax = window.innerWidth;(\)b4kM,}dFg
      yMax = window.innerHeight;
JA8m4FI:T       contentWidth=document.supertext.document.widthLk q+Yj
      contentHeight=document.supertext.document.height
a B i!J|N+pCr*Px`y       document.layers["supertext"].visibility = "show";
N%DF%PU_D HB(|.U       }#WYW:y1ZN,F;K
   setTimeout('moveBall()',400);5Ig8q;y+ZH?"y:o{
   if (hidetimer!='') QB tQ2`d C4oB
   setTimeout("hidetext()",hidetimer)ii rt6Fx
   }
[+qF E4wF4M/t YWd zAJ
function moveBall() {
6S)a\(Yh6j    if (superballRunning == true) {!v2H&bFJzBB8h:P_
      calculatePosition();4B1te!M6F
      if (document.all) {
*D~.U5E? }@$j+RP          document.all("supertext").style.left = xPos + document.body.scrollLeft;`dc w(_h
         document.all("supertext").style.top = yPos + document.body.scrollTop;&S!IU[ h6Em$f
         }
3^.n9]cXa4S       else if (document.layers) {
j_ws*PR'J0q:C3b+y          document.layers["supertext"].left = xPos + pageXOffset;_ \lvS
         document.layers["supertext"].top = yPos + pageYOffset;'gj0ix.j+h{Mn
         }
pU|Oh#|@       animatetext=setTimeout('moveBall()',20);
+r$RHZ W {       }ZI#R S FG_
   }
+f2]\(@5c&m
"E lQkQx function calculatePosition() {
]/`l%Q$Z5^q1LI.s    if (xDir == "right") {
h$p8E o'~Xk4E*G       if (xPos > (xMax - contentWidth - BallSpeed)) {
*i|N3M1F          xDir = "left";-[{4SOAmz
         }j#i d&uy
      }(vEgGt|yJ
   else if (xDir == "left") {
ItOh.O}R9d       if (xPos < (0 + BallSpeed)) {
+qyJ5u ?#P-uD%f          xDir = "right";
(|v O Ic v N          }I@`7|'xE/X]8v
      }"JYXS9Z$_
   if (yDir == "down") {
.R cYZ ?0u       if (yPos > (yMax - contentHeight - BallSpeed)) {p:~*_2R q
         yDir = "up";
3we%sa6O          }
8wV)C.`0KgX0{P       }byQ2`'BVE
   else if (yDir == "up") {
0eu$zne       if (yPos < (0 + BallSpeed)) {4p;b9Uy9{+Y0f O0dw3t
         yDir = "down"; P0L*w R6A&G*|n
         }
3T&C/iJK p       }~7NBEP(Y ]"v
   if (xDir == "right") {
[ f&A,j G8_6|0O Kc       xPos = xPos + BallSpeed;
g9c)M5lR       }1bdf,fs(x!e%K
   else if (xDir == "left") {
'ar_#\ofZ       xPos = xPos - BallSpeed;
riNv%V6} d       }4d3B}x5]4a
   else {
3r0w]O2b*zwe/p       xPos = xPos;
wE!rvk,~4Q       }
$Gd-_A&\&dH    if (yDir == "down") {Tq VT,R{U2P}
      yPos = yPos + BallSpeed;
5f6nn8t"f'BF;n*oD       }
0b$a\2s/fEn9jjgaL.F    else if (yDir == "up") {
gmYk0^ a i'G*T?;h       yPos = yPos - BallSpeed;}8aW1jQ
      }a5O3YN1}%H'oS
   else {/YlVf?@
      yPos = yPos; [ w _W:t
      }r7Q+[dcg#Yw,B
   }
-F*]#XW1q7s 2_tb+g)i.L^([
function hidetext(){a`yahe
if (document.all)
#Re+?2b8M supertext.style.visibility="hidden"
S:?D ?| else if (document.layers)"uR1mVIqce
document.supertext.visibility="hide"
3I gl@q tQ clearTimeout(animatetext)d.tE)H'Gc
}eqNS'Z3a [T

3w1P7NeH3J-]/J(jv4T if (document.all||document.layers){K$`W;h#C"_ZdII.R
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')~ _6u(q(W!~V,_
window.onload = initializeBall;
;H&A)u2{7t!@vU$h window.onresize = new Function("window.location.reload()");}5oW1WI
}
~|/dI7@
kiH?4[ </script>

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


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