捌玖网络工作室's Archiver

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

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

<style type="text/css">u)T7Mk'w/D$B:r
#supertext {
8V/?#Y'`^,S position:absolute;"pim~d
left:0;j'y3l1K%N(O&H!z
top:0; FG(zc)D7Ts`7?K
visibility:hide;
a~!X'`(o visibility:hidden;1O7G[R ho@w:y
}
Q4ADE)DMeA4Y!B </style>
8F {B P2]n3KPbe <script language="JavaScript1.2">Hvh {z;qI*Q o[
<!-- 改变下的字体的大小。颜色-->'n ~+}|%N h;x5h9g A
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'I&]1~GY"iw O
var hidetimer='';#o-Z6eO!u1W7zLW8~7WV
<!-- 改变下的弹跳速度-->2~2U%u5t-dvm
var BallSpeed = 20;
X*CGxzY-[ var contentWidth; B*X,Qi8dON cz
var contentHeight;
&E9^m3rF8eo7|.c var maxBallSpeed = 50;
9h~tz^ m-nq.G6`*eV.g(WH

`El;@-?\%O var xMax;
`~rP@dq var yMax;
%U8| Cme8G(`1i var xPos = 0;3r,x L[ P?|
var yPos = 0;~Yytyp M~
var xDir = 'right';
p1oA7k!k1^!P!HAj var yDir = 'down';BpZ6@n8J9j
var superballRunning = true;,uD%F6s6hzH
var tempBallSpeed;
Fyu`"d0c XM`.c var currentBallSrc;
w(X)e I XE'rU var newXDir;}^ z:U `3\e\}0\
var newYDir;
iiV.HQ
v$P-kLS function initializeBall() {
ez td(g \    if (document.all) {
K y8PE kh2Sy.a       xMax = document.body.clientWidth1hXT,C)Of`7G
      yMax = document.body.clientHeight
"i&Wz*b Z6BR x{       document.all("supertext").style.visibility = "visible";M4E.ngN U&\
      contentWidth=supertext.offsetWidth CUOcOa*Rn
      contentHeight=supertext.offsetHeight)s OeLB8v8@|\
      } p+E)rm/P [,b-I
   else if (document.layers) {
4@+z}9`3n0t       xMax = window.innerWidth;Lm oF"n,HV)D
      yMax = window.innerHeight;K T ET$[9l:E
      contentWidth=document.supertext.document.width o H%N$[ cs/}.S
      contentHeight=document.supertext.document.height*zbPg/H$j
      document.layers["supertext"].visibility = "show";z%ie_ ^ H%a
      }
}'w/L |`+\;UK#r    setTimeout('moveBall()',400);-j)fg&P0OOvu6d)lq
   if (hidetimer!='')_$Vi(fa5j
   setTimeout("hidetext()",hidetimer)
:D(UJ I:p b9N    }
q"C)[;F1p8b _y v(G ] Ov[o
function moveBall() {;dD-p#W#rA"V
   if (superballRunning == true) { k n7N5|$L],C
      calculatePosition();
\+c-G^(_-_       if (document.all) {[c!el$R7@|#DW
         document.all("supertext").style.left = xPos + document.body.scrollLeft;Yz q(F.b$J8y
         document.all("supertext").style.top = yPos + document.body.scrollTop;~}t1q(i3K
         }"a$zp;r`3X
      else if (document.layers) {
g^1o4wN:]5~:zA a0~V          document.layers["supertext"].left = xPos + pageXOffset;
3ILM#mH/@"O7uu          document.layers["supertext"].top = yPos + pageYOffset; [D i VP~q t/VV
         }?-v HR8uv5Vy!v
      animatetext=setTimeout('moveBall()',20);
mfz.w,Q.H       }
Ce3e#[F(t    }
5_0ocZU e(q2Q:d P Es3sQ9Qs
function calculatePosition() {
&^FQ1Zy;d    if (xDir == "right") {
#D:e6tK7K,YO       if (xPos > (xMax - contentWidth - BallSpeed)) {
k1TD3?-j/X"m\#n Y          xDir = "left";
1u j9Pn6Nd          }2_ZU1V_na4O
      } j }{tV!mm @a
   else if (xDir == "left") { _OlhQT5do/M
      if (xPos < (0 + BallSpeed)) {
B5Sf3d{YO }0dS          xDir = "right";
(b Sv0EW;c          }
H,OP(V7Vf?Rl       }d-D _+N;J:y*l8w d
   if (yDir == "down") {&WS:{J/Y` UF
      if (yPos > (yMax - contentHeight - BallSpeed)) {
,eN%Gq T4p9T          yDir = "up";
X;G*l"U6TU7I          }
:jIyCz*kJ?       }&z|NT:DY
   else if (yDir == "up") {
_S!OF)O0h       if (yPos < (0 + BallSpeed)) {_:OA1r%ku
         yDir = "down";
Iwg4A7TCn          }N4it|No#U(U
      }
L%_-fo"m`    if (xDir == "right") {
5rN7t`{mJWb(G-|9`       xPos = xPos + BallSpeed;5yZ;Kack.]*l S'c
      }Q6_8~v^V3F*i` |K
   else if (xDir == "left") {
I{,Ve XuT:x       xPos = xPos - BallSpeed;
1b p1|VE#`4^-p h {a       }
iqX6E-y'Jd    else {
d_2W_(@o X       xPos = xPos; IT E"Q#c m/B
      }8U4y4ANt rP
   if (yDir == "down") {
#H d/NWJ9u8Ll       yPos = yPos + BallSpeed;0bkyB4i e;{
      }[:{tG0q.w\:`#^
   else if (yDir == "up") {
u(?b V ~ anb       yPos = yPos - BallSpeed;
b2B*l)HnQc       }
Ilj.q:yC    else {N,U^9r ~ohc-~.M
      yPos = yPos;
F [M Z\       }(qg,H z1Y
   }
*DvtPmn#Jr&H5yZ |ch2G u.rnx
function hidetext(){&U Z K2C]}
if (document.all)
.Pk.p1SPtV%G supertext.style.visibility="hidden"(E&lW)H;k
else if (document.layers)
e.Km,p4r4Z/[ document.supertext.visibility="hide"
LY^#H?V$b clearTimeout(animatetext)$Y9_!u a*W!V.|
}
qMs-@ D)un-f #{Z^L __4y/qsp
if (document.all||document.layers){
}(E Ua3u#i/G3a document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')M-PS;?l.]5B
window.onload = initializeBall;
9y^i \"sn window.onresize = new Function("window.location.reload()");
b+@7E v4u1_@ e }
/}.su[6U[\%m
N3ZC,cFAA Nds2f7d </script>

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


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