捌玖网络工作室's Archiver

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

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

<style type="text/css">*?M!AqZZ.e6_
#supertext {j/m3qh2un6y4G
position:absolute;
w`!lS F2|z.\ left:0;
$Q[7S;JC4Dm(a top:0;
BYPK.TJ*_S visibility:hide;+?&\5nnu+[
visibility:hidden;,|WrD(gt+bO)B
}
b]O*d2vEF </style>
Ruk'KaQrD <script language="JavaScript1.2">
$A'k;FB m&jo8MwV <!-- 改变下的字体的大小。颜色-->
+w5o#L3sS*C var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'|R2|Tj2E
var hidetimer='';1l'wL3^Mj"B9^
<!-- 改变下的弹跳速度-->R'Z zBP5F o&`%u X
var BallSpeed = 20;
[+Dz%~ k Cg/SE:M~ var contentWidth;
0e8Rt SeW4Ek var contentHeight;t1W D`o.?baX
var maxBallSpeed = 50;
T-m#q0ul9b%y
h+[B?}Z&WQ D
U6k x? vjE/i var xMax;l9OSI2_
var yMax;
7l"W?&yq`p!D var xPos = 0;
g o/M_9?3@ var yPos = 0;3y$E+S$cNhf
var xDir = 'right';
0c,B*w6_'gaP:L var yDir = 'down';
\5fF2\0kg \ var superballRunning = true;~j0LU6`$a b&RDk%X
var tempBallSpeed;
@mZ0Wz;UF x9k var currentBallSrc;%kdxIu9C C?;J]
var newXDir;
.['yXE {9h var newYDir;
PBhuw } GpO#T
function initializeBall() {
z O'Sq"h7z    if (document.all) {3z \M1[K
      xMax = document.body.clientWidthH-B,P;a p
      yMax = document.body.clientHeight$xP3@Pl8X
      document.all("supertext").style.visibility = "visible";aOKv,P ~+q
      contentWidth=supertext.offsetWidth*}&Y&g;?ff ] V [i8k
      contentHeight=supertext.offsetHeight
&rB,t#t%K:j lr       }
U&U;y_Ai @plV4X    else if (document.layers) {
5L7_| w"[6oeL       xMax = window.innerWidth;!h-G}*||;m`DA
      yMax = window.innerHeight;
JR+_ ?fE4w&?T       contentWidth=document.supertext.document.widthRQ9M;o+FL9b$u)d
      contentHeight=document.supertext.document.height#B8@\B5N ue
      document.layers["supertext"].visibility = "show";
0W? |KvR2I#D       }
+^ s.d2I'B k;pq'T6w    setTimeout('moveBall()',400);
1QLk jV    if (hidetimer!='')
P/j:qFu h    setTimeout("hidetext()",hidetimer)
G&@ gs.]mAs    }
9E'D/WTRc$Ro0r 9^?|?#t
function moveBall() {#dK!|Y xZ
   if (superballRunning == true) {
Ttu1e2?![t9w       calculatePosition();
-Z,u)AZ!n&f       if (document.all) {b$I#`'x(e$dfuH
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
*n U8l+[&jb          document.all("supertext").style.top = yPos + document.body.scrollTop;
$m:_'R q9aI_VQ          }*cCL+^_,A0m{e
      else if (document.layers) { V Cp!Q9Fs U M @
         document.layers["supertext"].left = xPos + pageXOffset;
J JY%`m,r^          document.layers["supertext"].top = yPos + pageYOffset; L,ffs5u5y/x
         }
x+UZ6Q` MmK'S6N       animatetext=setTimeout('moveBall()',20);
3hfDQbC       }p"f2t D:o(n[ EH
   }
5]{ ?7fxspE a'L)w EI`6e9N
function calculatePosition() {
-W E'Ip:f on    if (xDir == "right") {
C8@rYp#Hk       if (xPos > (xMax - contentWidth - BallSpeed)) {L+ZshsHlIN
         xDir = "left";5k0OA@eL-JZ5T
         }
f_?I.@8`9IHH       }
tE;d1NWw;? C%VAy    else if (xDir == "left") {
E.z Xm%dx8C       if (xPos < (0 + BallSpeed)) {%c.r/K W&v,n,h;F
         xDir = "right";
!|+`(G J'Y?P7{          }9uZC3lt&s,G3C R
      }D3LX{*}r?
   if (yDir == "down") {fpt P`\1X D
      if (yPos > (yMax - contentHeight - BallSpeed)) { vJb6?(l;{n
         yDir = "up";
.Jp^)P(Qd9puy          }
vn:a _1H^Vb       }
2i1KL"ZW*Ts    else if (yDir == "up") {
I9@;?dC u|I       if (yPos < (0 + BallSpeed)) {.O!Ob W1~M]p
         yDir = "down";r cY!xV3l$^
         })]m cJZ
      }
6r,\b o kN+N3I {m    if (xDir == "right") {]v h#k%x*e
      xPos = xPos + BallSpeed;y(xM-lm(z'G4@U3B[
      }
^0n#Bx7IQ] UE1`F    else if (xDir == "left") {
^%{)oV w%mc,Sce       xPos = xPos - BallSpeed;lnCqu+mE
      }4[$U-})R Uz0Sc h`
   else {
4f;N+HE [NZ       xPos = xPos;
I"R2ns3qC.V       }
g%Qd9^mMkb@9H IC    if (yDir == "down") {
-qr1sX;W)_1?G4A P       yPos = yPos + BallSpeed;
!Mk/z#H5o9HO7A       } T\+jH nNg5Dg
   else if (yDir == "up") {
rk V1`'lPH       yPos = yPos - BallSpeed;
nd ]7U@0I(h8T       }(a:XF*U#f;j M
   else {;C"E;L&r?
      yPos = yPos;w7~7t~"c!a w
      }
]$F"|1my1{K@,U q    }
Lz%EbyJqO:A ;ps(gTq,r)|
function hidetext(){
*N*M D {^[z ]Qh if (document.all)+a zd!h Z D6y!?
supertext.style.visibility="hidden"
Q?1g*Nv Xl else if (document.layers))_:ajJ B2H
document.supertext.visibility="hide" f aV.jGi8L#O"o
clearTimeout(animatetext)
0M?:WR9D+gP }AKz0Blf0h

k%v1Q"l&G$A3Z S.m:F'W\ if (document.all||document.layers){
?HY;kM7Z document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
Dd\s9h a window.onload = initializeBall;b)u,t;e f/n I)r
window.onresize = new Function("window.location.reload()");
X,Q3\ I;~ x%S }0c1G/~7|O;fB!b4t0~

uI6Z9pJ`D#[D </script>

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


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