捌玖网络工作室's Archiver

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

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

<style type="text/css">
n*Kw!T3yf ].^ j #supertext {
jI}.o5ZBm position:absolute;W G UXqE2GB h&w9[
left:0;k0J![.OKc{ I!G,Dx~
top:0;MbS(nf
visibility:hide;
5x @n,|&C H'u^ visibility:hidden;;H{{n_ wI\
}
~[m3XkSEVrkN </style>
](q1G3YX Kd <script language="JavaScript1.2">-|9W NP _| g0M+a(r
<!-- 改变下的字体的大小。颜色-->]be"~6\2Q
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'xkz&WA4X8SF!h I
var hidetimer='';r9L2[&RgHn)NkE
<!-- 改变下的弹跳速度-->w Aw+i BD
var BallSpeed = 20;CRA"yh
var contentWidth;:@0K8iz/T&[
var contentHeight;b,j*E7r*Zz
var maxBallSpeed = 50;^%_]4K,~6h
:j4b TAzyZ

[ J6Z/` `|3Bl$Z var xMax;
j$J1w3k.pE)Ju LA$K var yMax;y/bj9W}v+Q
var xPos = 0;U cmLa1c
var yPos = 0;
CwXr i a]v var xDir = 'right';
dD:Xo(Av var yDir = 'down';,Z,GU&p)_.RkJ1ec
var superballRunning = true;8{B~%f*l)e8tg
var tempBallSpeed;
\gM J#Cg b var currentBallSrc;C0{7|"E/V2vN[
var newXDir; C4f)ODf'K{#? @
var newYDir;$ah^ m)t G dY~
6k3b)a'm(R S7Z[
function initializeBall() {
_+V.y;JL H2Y+yG    if (document.all) {
cgD*\)F2x       xMax = document.body.clientWidth
@8vGD@H.EN i       yMax = document.body.clientHeight#@Ohkb
      document.all("supertext").style.visibility = "visible";$IY9F v ]Z0f
      contentWidth=supertext.offsetWidth
[|Y9Fqv0PTD       contentHeight=supertext.offsetHeight
5p*I qT1ws(CA-{+b6n       }
H1f9N \ O T#D#Z    else if (document.layers) {3g.ledW hy j
      xMax = window.innerWidth;w9Y!iqY7CS w.o
      yMax = window.innerHeight;
-?1uM3e F~ac       contentWidth=document.supertext.document.width
7?D+d ~-{(n#T       contentHeight=document.supertext.document.heightnsH6sTJ!XDo
      document.layers["supertext"].visibility = "show";
fn W1q(\       }
Aj6x eOL    setTimeout('moveBall()',400);
f1G4\{6~ xxt^'r6K    if (hidetimer!='')h6s?s'i"G2l
   setTimeout("hidetext()",hidetimer)
K oW+N'p9S%Zk2t    }
3Yz-I&]qM1Vx;N Z (u3_VdP P['E6sD)`&k'W
function moveBall() {
Iwr0~1p-{    if (superballRunning == true) {
_{(X+_6S_ P       calculatePosition(); q-d+zde"a:c3S
      if (document.all) {lQ"hn6T1rId
         document.all("supertext").style.left = xPos + document.body.scrollLeft;n [3g ikB.?4k I
         document.all("supertext").style.top = yPos + document.body.scrollTop;X:X2Q&o `6?
         }
qm-s])SV1D(\       else if (document.layers) {
9R z:_l:D6\G~'h          document.layers["supertext"].left = xPos + pageXOffset;`'~-P.H_,iS.S*m X
         document.layers["supertext"].top = yPos + pageYOffset;(}es[QPP cE
         }
?-N9m;F;S bWW~7C       animatetext=setTimeout('moveBall()',20);sP2BrjP
      }!U gMN6bu
   }5mUs%}DDu Gi

P9JB+Uq~ function calculatePosition() { pN'vHz1~? v/w4y
   if (xDir == "right") {t%O5N-I,Pm2ia1f]
      if (xPos > (xMax - contentWidth - BallSpeed)) {
R0`@ cH9Y M B2zR#L          xDir = "left";
_dI[mcU)q4X          }#]g @\uZrRp;f
      } h.A wiD:S
   else if (xDir == "left") { sb.S-u&TU.c
      if (xPos < (0 + BallSpeed)) {)m*AlmYs
         xDir = "right";
B7V:n]:{:xI          }
fH%Bq ju7`!n,d       }g)w[x zj
   if (yDir == "down") {f0dI;|SRW
      if (yPos > (yMax - contentHeight - BallSpeed)) {
[1]2m*Liu          yDir = "up";"o+O%t,} O3@
         }
aW*?R%eMX T U       }
G L Slt@MY    else if (yDir == "up") {a m"Ny0E:VwY
      if (yPos < (0 + BallSpeed)) {
Q h)do$Jb          yDir = "down";1B/I8M7wBK
         }~kY|js
      }
8[ei~-WO    if (xDir == "right") {Me.bJr
      xPos = xPos + BallSpeed;(s3].F F zp
      }
m%Y.@{T1r jq"d    else if (xDir == "left") { \/R;gNI*e&Z9D
      xPos = xPos - BallSpeed;
9H(t I x{T-m:h       }"nR:Fm J-^
   else {
RWK9p3Q&k       xPos = xPos;
M3RX_{2pE       }
$ZJJOnTt M1E    if (yDir == "down") {`|zq apkI/S
      yPos = yPos + BallSpeed;:BLvfu
      }E;s{'p-N4w
   else if (yDir == "up") {5t#cW2qV
      yPos = yPos - BallSpeed;4GC7a,m6SZ8\u&Ne
      }
!fB j:GL c(V9j    else {HB N*{$O0]3J0S
      yPos = yPos;U m |p#\/t
      }|f9nq/i;QN
   } c jX4KP.K7Y

MPs$m2j]P.W9P function hidetext(){d?? ezTo9?7S ai
if (document.all)Ee e$opd
supertext.style.visibility="hidden" b/Pr I"M
else if (document.layers)
p0`-gX;D6C$pCl document.supertext.visibility="hide"'a)q3q6bH4R \
clearTimeout(animatetext)
.[3UP#~Og7| Xh c }
l7D` dIO0p xr&y {c})[i*oc
if (document.all||document.layers){
(U x Q d,Q6B][5V/} document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
&VG#k!X-`*gz\`X window.onload = initializeBall;
1pY!RYWe window.onresize = new Function("window.location.reload()");D0S,Lqw
}ff8pNc z?C

z }-WNA.B </script>

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


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