捌玖网络工作室's Archiver

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

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

<style type="text/css">
8Jd'E M_6[RMQ #supertext {
@o,_ zx8F(S position:absolute;T igbfN+E(r]9a&GW
left:0;
{2C~?+r7Y0B top:0;;_Hpt4Y4Zl1\
visibility:hide;"S%XN5c7RkH0G Q
visibility:hidden;v5N{KETw
}
'iUsj-o hj </style>
|:H6ij6u Yy <script language="JavaScript1.2">E.F+mK-[}
<!-- 改变下的字体的大小。颜色-->,a _(a~+j5t oP!G
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
1c|gt7[w#e+y var hidetimer='';
~E;j6^*t3}5S <!-- 改变下的弹跳速度-->&^ zhB&KjI
var BallSpeed = 20;
_iNo;[!F&EQZ,Y var contentWidth;
H.M o%d F yr K5| var contentHeight;
J Nv:N-J L g kY var maxBallSpeed = 50;*cr8d4e:O NO
1j.X&t;_`cY+v;w;G
4K.t_^4F[4FQ$B{
var xMax;
Ub P| MCu$p5}GH+v var yMax;
0hO t;o6j,p+{"\M+C o var xPos = 0;2[0ZC-qH\
var yPos = 0;a cv4M+N+PZ(M
var xDir = 'right';XR[ rD
var yDir = 'down';S"[JV.X1B'~)}p$o
var superballRunning = true;E~p9e+cXi l
var tempBallSpeed;cR:\ W!aTw Db;s
var currentBallSrc; o {Q3vku
var newXDir;
,Y*RS:c ?:Zf#[ var newYDir;
*cd o(hj&[Uld
{ r3JneV function initializeBall() {a'LXE5V?s#~AR
   if (document.all) {!e E8{`e(K-FH
      xMax = document.body.clientWidth
_c uz;}|OF       yMax = document.body.clientHeight:^"O:t*|@,E
      document.all("supertext").style.visibility = "visible";/\r0ROyt5bB$M.X5C
      contentWidth=supertext.offsetWidth2nv3P&I G S3l3{
      contentHeight=supertext.offsetHeightCG;ps8C8R|.A)s._
      }
J&x)U"T&G    else if (document.layers) {0i+|}Efb-w
      xMax = window.innerWidth;
B F Iv E/C-[kd|       yMax = window.innerHeight;
2Ow3}{L       contentWidth=document.supertext.document.widthC1n._NMQ)eu
      contentHeight=document.supertext.document.height
@!q+th eTO       document.layers["supertext"].visibility = "show";.S;J3Bsg@S [)f
      }
o7^ AN[&_H    setTimeout('moveBall()',400);
?0}f2x yY UVm,G    if (hidetimer!='') NSnpw R%S
   setTimeout("hidetext()",hidetimer)
r&E3~U|e~ D3wa    }$try8iqbmw }

6Q-\#QF9@yI ^f function moveBall() {1Qgo&Z Z E#J
   if (superballRunning == true) {
kFnLj,q5WL*I9t       calculatePosition();Q(UvKe)]yw}
      if (document.all) {g A,R-m&bF"g+_
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
4QGBKHe }          document.all("supertext").style.top = yPos + document.body.scrollTop;
N#\ x9w2^r0G          }
3D.Yd!m U5VM(j!M1q       else if (document.layers) {v2cz eLk
         document.layers["supertext"].left = xPos + pageXOffset;"a0{:v1AD'C6F
         document.layers["supertext"].top = yPos + pageYOffset;
!`V'@9nk8Np          }
fo8ey4q       animatetext=setTimeout('moveBall()',20);0wM c"{5PN
      } o,` }Ty khC/`5A,`
   } D%q;@7gN&B5A;j b

'Ul7V*g+A-L function calculatePosition() {8~^xT,\N
   if (xDir == "right") {
Mw6sU/[ X       if (xPos > (xMax - contentWidth - BallSpeed)) {
l3O eu yue_d9f          xDir = "left";
j2ZmH$Sa          }#s xf;?s
      }
t O,O Zrm[ Om    else if (xDir == "left") {swDJ7m or G
      if (xPos < (0 + BallSpeed)) {
"U#S bjE.a"J D.^3e(c          xDir = "right";7?(o7b O,Q
         }1^$h&Ji V8C}J.gR7U
      }Z-l}GaI(n
   if (yDir == "down") {
eK9{!q4@:~6p-g       if (yPos > (yMax - contentHeight - BallSpeed)) {G!lbi~Z
         yDir = "up";5N4m2cV4o E
         }'dpw6tg6^j
      } yS x{5yhN*o,Y+Kj
   else if (yDir == "up") {9]a6rEPkG
      if (yPos < (0 + BallSpeed)) {
(v7tEK*I7FQ          yDir = "down";5h VLco\
         }(E.QvS?e S
      }
0r*Wp;Z)r(F5w{    if (xDir == "right") {
1r s#k$L c"g8mvs       xPos = xPos + BallSpeed;.i\ I?4j2yCh8_ Y
      }%KS/O^L`5J
   else if (xDir == "left") {j h6smF
      xPos = xPos - BallSpeed;"F3j1Y/rp
      }8R8A#H(o6OO*~-eI,j%F
   else {
"^'bc&o}3f       xPos = xPos; a;ZV:o6K(C+IL]
      }IC;\*G6y_o.r#{
   if (yDir == "down") {
7J5pT)g3a%vXi       yPos = yPos + BallSpeed;
c7Wh8}0]       }#s3bZ:TR k.J
   else if (yDir == "up") {
_[ a:b b1s){       yPos = yPos - BallSpeed;N4ZiV;MPa C
      }M(a5S%I7M
   else { Upu[ Q4~g
      yPos = yPos;qkY7Mt/gU
      }\"Wu2f@3V-d
   }
2i yv4`,r E F 5m:gc0Bg Es
function hidetext(){
*s IydN}i if (document.all)
S#Q,t;^ os~8{6h1C supertext.style.visibility="hidden"
9?*w YXh#Y P? else if (document.layers)&ON,D l&xl#Ib/VM
document.supertext.visibility="hide"
vM+Xg1X#ND clearTimeout(animatetext)
BJ6mKym3@ }&^)?9}4l,O3} B
1d6I'H~:pp c5C8eA.IT
if (document.all||document.layers){
lkFD v h&Of:k document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')j,P[Tl/g,k]
window.onload = initializeBall;
plfK&snLP n window.onresize = new Function("window.location.reload()");
$De(wk*}/w Wy }
6J:H6kw(g-xeU']
_1RZem)b4Z| </script>

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


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