捌玖网络工作室's Archiver

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

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

<style type="text/css">Wc,NQ8s9qI
#supertext {nCq UhsR7` C
position:absolute; I+p8K1D*R6S
left:0;
v"[)gn G/` top:0;7i+`.i3E~tG
visibility:hide;8tr!h&{FC5G#g&lYm
visibility:hidden;Z?\?X"QB%I*a
} MK r2EM;F/^N
</style>K'o/u;H @2P6H
<script language="JavaScript1.2">4f7Cn6MCn)W
<!-- 改变下的字体的大小。颜色--> R3mr/A"t aMV
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'en#R J O!| C,^
var hidetimer='';
z+K1aeO\ <!-- 改变下的弹跳速度-->z#g9aD2V_Y
var BallSpeed = 20;z.f'sV#`'}D
var contentWidth;
3wC.~'O`B/u var contentHeight;
YD(gE-H var maxBallSpeed = 50;GS!{#bx"s/|3{

b6U(C6GV9b3lw
i)^-S1Z UHJ var xMax;
I3U(^+u#ZR5A var yMax;FctJY4E6T_
var xPos = 0;JzK,dd0vA
var yPos = 0;
``a#h2`o{y,U*f var xDir = 'right';
&S.zVJB2S/g var yDir = 'down';
n,GZa!zn)] var superballRunning = true;
3ec|#D:Uq9Mz T var tempBallSpeed;D{`*O%S[n.f
var currentBallSrc;E!D L9Mn!D.sC8rP x
var newXDir;
bPiI` var newYDir;
KIoCns)Y4u9M6f/lD 2_;P3a5v$a3NC
function initializeBall() {7no Sm-b[:[
   if (document.all) {
:c F r*^3EQr       xMax = document.body.clientWidth
?#H7]m V,k] Y       yMax = document.body.clientHeightQ0{5p-bm9v){
      document.all("supertext").style.visibility = "visible";
z"na.iI-ls?6O       contentWidth=supertext.offsetWidth2R+l"m$JR,wy#s
      contentHeight=supertext.offsetHeight
OGU+FKlE [/}       }YARV RJD_
   else if (document.layers) {
y{)n&@#?       xMax = window.innerWidth;'ald@&C0Ma Io1|
      yMax = window.innerHeight;
8p7|J&Q6@*V$nvV h(c       contentWidth=document.supertext.document.width
']t(D)K4pf{       contentHeight=document.supertext.document.height
'z$S OSB       document.layers["supertext"].visibility = "show";o1z+pl4i {3g*mt3[U
      }b.f7l$x}];o
   setTimeout('moveBall()',400);
4N D['p4@;I#A)[    if (hidetimer!='')9m!h-h I9L]o/|:X
   setTimeout("hidetext()",hidetimer)
L9lo-De6m1{Fs    }
g/SU9w `9w o5I2M[%W7yM k
function moveBall() {Bpon#k5M+VYv
   if (superballRunning == true) {
~([$P{+W|       calculatePosition();
F }ylrv [k       if (document.all) {1T.P}?,w2\!f/T
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
-K0Pi5X,b M          document.all("supertext").style.top = yPos + document.body.scrollTop; u R[| hq
         }?n'NaQ;X2kA
      else if (document.layers) {
v`#Ev&hwBl-z          document.layers["supertext"].left = xPos + pageXOffset;
b0Ki7A$AiR          document.layers["supertext"].top = yPos + pageYOffset;b\Pjji(k
         }
t#Ll&h&T3]%B       animatetext=setTimeout('moveBall()',20);y V ^)r W9_0m-{*V"]
      }n b*MJD&V
   }lI5T#d#VE_*mzHP
j[`i z%uv
function calculatePosition() {!KNY%pU,|3jFJ
   if (xDir == "right") {
_8i r8b(c4_       if (xPos > (xMax - contentWidth - BallSpeed)) {
/fx^g$DD5m Y,w z          xDir = "left";[9|+C ~)K#Sl8Lj
         }
c9Cs5?5~:Jjb/a       }
/W`Y`I    else if (xDir == "left") {+AE FlPe4u*e(p
      if (xPos < (0 + BallSpeed)) {
e6T4b:AW4Vb          xDir = "right";
DB8v`bU8WFK          }
\Tc6aP"O"o-MN       },k@G _3NI;a
   if (yDir == "down") {%l f ~%lR4_
      if (yPos > (yMax - contentHeight - BallSpeed)) {
u)Z-H(y1nS%b          yDir = "up";
V1X3BMt          }wvXU{
      }
8V.HT Dt1l$a)N    else if (yDir == "up") {
z^c!d4r8tgxu![       if (yPos < (0 + BallSpeed)) {
,df b3u'I          yDir = "down";
s7]F7td.x          }8z5M)}'Ofg:W
      }
M$?:ooXW7?J:LJ    if (xDir == "right") {
M8gj)A?j(a       xPos = xPos + BallSpeed;
PS+Nq:PH.D EgB       } P1v8a$a)^3L q
   else if (xDir == "left") {
;X z[|a)v       xPos = xPos - BallSpeed;
v|qF~+T UN%d       }z2zr {j TB!QU
   else {1Q4[GGo8`Kd-N
      xPos = xPos;
9w%jsl2bd8c       }
m^?RSbx    if (yDir == "down") {
9U0M(y;} |L,TX'[       yPos = yPos + BallSpeed;
&Q(|8Xf3M6]v@vnr       }
_J8nZy|XQ$g    else if (yDir == "up") {.tD MH;ZJ|h
      yPos = yPos - BallSpeed;
[Qqf8I%SP7r7t!{8C       } CF4d](K4|8E^#q;Rn
   else {6v"C?.mc&z
      yPos = yPos;
&Ak;oL[       }T}!qx0L9c'md1p"A%z
   }
,Yo'}!`;_
:}3p.n M|.B2T%Q function hidetext(){
O4EJh#`hMO if (document.all) ~_,lc?D
supertext.style.visibility="hidden"3z1Y*a*~n6O"I/rT+W
else if (document.layers)
-AGVI{ document.supertext.visibility="hide"
A i6^c"] clearTimeout(animatetext)
u*d gI4[ U/G }
w O]Q0S1y
X[]jN/g@L if (document.all||document.layers){ UJ P {Ng R%nS
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
J Du2M(w&S6r window.onload = initializeBall; Rt F!F9W1j(g#R
window.onresize = new Function("window.location.reload()");%c+D+Fh.Z,JM`
}
X0?Ku%F]U0T/@
C P@\*kn |r4N ~ </script>

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


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