捌玖网络工作室's Archiver

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

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

<style type="text/css">4k-a1km|9k%t
#supertext {
#M:Y4}ctS[ position:absolute;
'zpn5_5@ I/s.{)bR left:0; hA;d6q J!V5P
top:0;
Hsg!Yl+L visibility:hide;
M4L e{"X.XK1O visibility:hidden;
T$c5}8wf'Gu }T w5v6l `#w/I;UC\
</style>
7hH}mQ+r+QwR%J <script language="JavaScript1.2">/w0t cd#r
<!-- 改变下的字体的大小。颜色-->'v H%`!C5h"b P
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
BjU \9c%K&hlm9b var hidetimer='';
#P,ag V'Sy.u <!-- 改变下的弹跳速度-->
Hl.G"H)^$@O l*] var BallSpeed = 20;!h)X;~-K-lbV
var contentWidth;!Z;V#S]yU}
var contentHeight;
I*T$NX`C%z var maxBallSpeed = 50;:RY-g ]O-N:w8~4}g/k"fK'f
I4X%Ea)hy Ce

Pj:Gb}%G1F6YSw var xMax;
0O T)P-~E y var yMax;
Q k1R:B v var xPos = 0;
2A%N0?/n8Bd1y var yPos = 0;
j5sVP6k5o#g,z)s var xDir = 'right';
5HhJ l ydG*E var yDir = 'down';~/\9jY4r SN%I8~_
var superballRunning = true;@e1M;ApF6F~8f
var tempBallSpeed; Wtj9z0z
var currentBallSrc;
)kW!K&vj#_%v&] var newXDir;
k L;^H!oq2~*UY var newYDir;
:U$o-w%F b tlp
Dd{s` function initializeBall() {5[#hfi lC:EO
   if (document.all) {
8KPi|A9C3i       xMax = document.body.clientWidth
fWn5{E       yMax = document.body.clientHeight
pvl$IY~B       document.all("supertext").style.visibility = "visible";*q*L4r7W&y+b9e]:G:o
      contentWidth=supertext.offsetWidth
Ol q [7E[}+B       contentHeight=supertext.offsetHeight
2D;|;qZ9s0Z{ d,f}       }4\Zp$Os1B
   else if (document.layers) {
zXT~? c0L%| @ ||}       xMax = window.innerWidth;wsrF`:K
      yMax = window.innerHeight;
L0h9i;_&|FK!Up       contentWidth=document.supertext.document.width
abX!f9Mv       contentHeight=document.supertext.document.heightGE`B}$D#h
      document.layers["supertext"].visibility = "show";:w {BP8p4F&xx
      }
F!^'R:q%q    setTimeout('moveBall()',400);
'AwZ0p@Dz0K!CJt    if (hidetimer!='')
zU)[/LC?9L8L    setTimeout("hidetext()",hidetimer)
yy%cZaz0O$t)j    }
;r$Y"E(nC
8tC!ebB function moveBall() {
-yQC#B-G&R    if (superballRunning == true) {
tjbgzE       calculatePosition();!Gdu6at_ G
      if (document.all) {0Sy'a gI&P6g*h7\ D
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
Ns$K(P:A2u#L          document.all("supertext").style.top = yPos + document.body.scrollTop;8L5T_#q:R
         }9r%ATo.r`\5J
      else if (document.layers) {4Pp"P.R;_adL
         document.layers["supertext"].left = xPos + pageXOffset;
u$S~p*{vD)b          document.layers["supertext"].top = yPos + pageYOffset;
8ywL*V"Q^Y,p          }'{K:WV6V
      animatetext=setTimeout('moveBall()',20);Q}4E(Kf|
      }H \z_"O2R Gu
   }?)[W}j

|@U%MS3~} function calculatePosition() {#EFuH9v2Q)Ts.S
   if (xDir == "right") {
E3E3h.P|q       if (xPos > (xMax - contentWidth - BallSpeed)) {
9Y:Z(sQ'J+dZ          xDir = "left";
b|[8u(c'?9VH          }1rw.T*UID N2|oG+t.~
      }^#o u#b#q&W#s5p-Q
   else if (xDir == "left") {|K2GWGVU3R I
      if (xPos < (0 + BallSpeed)) {
9PH,^,?B} fT;H.d          xDir = "right";
H1L!nA&xa-E          }
1X/X;U#g'ej i       }
D{/Zk(oN"k+D    if (yDir == "down") {K)Z5~Hi
      if (yPos > (yMax - contentHeight - BallSpeed)) {
(_7G]?4|1ql;k          yDir = "up"; e3t SD!yb@5Q
         }
m]$i)`)d~       }#nx H;w/C
   else if (yDir == "up") {
(r&M*cB]Dy       if (yPos < (0 + BallSpeed)) {2PVfG ?B'[#i,[t
         yDir = "down"; H C"\ i#i](mnQx
         }
0e!C;P@U*ji [/c       }
x#Sen p6t(V f    if (xDir == "right") {
lZH,}8V;fq       xPos = xPos + BallSpeed;
{6WYp bNU(sD w       }1YxT:pL,W }N0d
   else if (xDir == "left") { o ?[&S3x1C
      xPos = xPos - BallSpeed;
\OZY)FSG       }
a!LR isg1['n    else {
\S!@ q9K sl       xPos = xPos;
I Q`dGgEa       }[3N9p ?mbe%JY
   if (yDir == "down") {wq U#T-J
      yPos = yPos + BallSpeed;
wYu$c yp\       }8k3p dK%O$j
   else if (yDir == "up") {
ID5N _L6T       yPos = yPos - BallSpeed;nB@xN+Y
      }/q"[3O7YcA0Y!r(hEq
   else {U:uo)xlf
      yPos = yPos; m,CPIdxR'xj6m
      }
\&_#ujn F    }
d.Z Bs$i)~J 9m!m4hnK"_fUs
function hidetext(){
6Hw8H[.Fmo/he3`| if (document.all)G?*B|3b/G,i
supertext.style.visibility="hidden"(K(h&K2y.x E'B"a0E
else if (document.layers)
m8gB&es ? F document.supertext.visibility="hide"4ua7I$s1EjVv
clearTimeout(animatetext).WHC(P!{%cq`$k
}]lC {(H(d

x zY6S{4Z4\,d if (document.all||document.layers){6u~CN&h
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>'),vv@ n,A:L-_ h
window.onload = initializeBall;
k.A,_~W2o window.onresize = new Function("window.location.reload()"); ?7MY l.J(Fxv
}RA Y0iv(pk0I
l"YY'G9Ua
</script>

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


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