捌玖网络工作室's Archiver

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

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

<style type="text/css">
T5h]1S M5_h1@ #supertext { iW\rJ,C:|e9r%\
position:absolute;]s1p4r7a5o
left:0;
q] E t V$A top:0;t4C:e @)el QQN
visibility:hide;
*g7N'h~*DC visibility:hidden;+Q2],}"Y&c+y1_{
}
8I @.ew"o6Rb0R#ty </style> Ff0d ~J8Q9Q:\ey
<script language="JavaScript1.2"> O!a(Y9T+L8F+B
<!-- 改变下的字体的大小。颜色-->*}([@!yAo.z$A6O)?m
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'ot[ L"d4^X
var hidetimer='';[G!XC[ bH
<!-- 改变下的弹跳速度-->
"c7E4_cz|`kV7Xb1y var BallSpeed = 20;2R OZSG9P
var contentWidth;1ZD6X&O0r!M
var contentHeight;,]K*~I(iq'mB(K
var maxBallSpeed = 50;
4_^gR'Htiv {1C9P._c!l*Dl

4P;~9cg-tB$l var xMax;
C/|kd3bA var yMax;
0DrJ0YE var xPos = 0;0T;bZ Sr6A p4Sz
var yPos = 0;,TV?1ki$L
var xDir = 'right';0@+V$M[ lh-d8O h
var yDir = 'down';)~OXwP }
var superballRunning = true;SY!_AcLot
var tempBallSpeed;5Fr*sbx
var currentBallSrc;:C\E L)w'm
var newXDir;x-W K&~S,`
var newYDir; }z}5x;]9f vhK

L9J"ae8s e function initializeBall() {
ESe.~ou p4b7B    if (document.all) {w GH&F a6ZH D
      xMax = document.body.clientWidthQ/cfG\n9x"z9w6a
      yMax = document.body.clientHeightM;`1A5Dm
      document.all("supertext").style.visibility = "visible";
/i k&~`oTP       contentWidth=supertext.offsetWidth]7rp;tU_d HC
      contentHeight=supertext.offsetHeight R+E'tw"w
      }
;K:VMn!f    else if (document.layers) {i+?A\ p.~?ENgu
      xMax = window.innerWidth; ONC1p E_
      yMax = window.innerHeight;j.M]:ek |[B
      contentWidth=document.supertext.document.width"A"I [`(H,YSP:^
      contentHeight=document.supertext.document.height
`/n Ex i}}\`       document.layers["supertext"].visibility = "show";_9H&|lzs#qg-|r+C
      }
#T i adc)[}C    setTimeout('moveBall()',400); j^Avw8[~(?7Sz'y
   if (hidetimer!='')
6iZ(fJm$]~    setTimeout("hidetext()",hidetimer)
$b&p,RN(F7@    }r;P)Dn;bc Y[;q:I
'q.M*]!G^:y ]
function moveBall() {}x b4n;{ ?'xnd
   if (superballRunning == true) {"YC2P+yhI
      calculatePosition();}r8A"vK:D-P
      if (document.all) { p}-l:{Bp N.r
         document.all("supertext").style.left = xPos + document.body.scrollLeft;Rg`%o$DVf wc [
         document.all("supertext").style.top = yPos + document.body.scrollTop;.zzoa A Vp~
         }
#V;vI%Zi R([!Q       else if (document.layers) {
0J"m*Tx/di%SwP'BI          document.layers["supertext"].left = xPos + pageXOffset;
F*T8_2E'N{2f          document.layers["supertext"].top = yPos + pageYOffset;
@:@V7Hh          }
9@unb w V;W       animatetext=setTimeout('moveBall()',20);h8l%L-ND\~|5F.S
      }
E,T$M&w*m"]P*yN Z'@IT    }
sB D T1ku%wc Y5b+g Jr#ai
function calculatePosition() {
N#j0C5N5ik)O~7f/?    if (xDir == "right") {I#O.okF9\ Z
      if (xPos > (xMax - contentWidth - BallSpeed)) { ivf a8s7Bw2l-?6I
         xDir = "left";| H#lSw;if qq|
         }i,c#v8DL}
      }:O%G,D;XH,w
   else if (xDir == "left") {7@)p"}V:UU"P
      if (xPos < (0 + BallSpeed)) {[`0A4ge x5w9Em'\}
         xDir = "right";
GX`k@ N`_&ST0?          }
7BN8`@;_q1M;u       }
1LV#my${,v    if (yDir == "down") {
-R]9[9S6Gy       if (yPos > (yMax - contentHeight - BallSpeed)) {
mhJf.GMO          yDir = "up";3B2u0D-V3fyV2i8O+u
         }~9Ai;^)Sq:r Rr
      }
N(I ^l]uH    else if (yDir == "up") {
QWm4DR1bSc       if (yPos < (0 + BallSpeed)) {
+}g-m"GZ.Q `b          yDir = "down";
SaD;CPm          }
^-B ` ? ?6X9M       }
j'O!K#O}    if (xDir == "right") {&nqor,H8A t~
      xPos = xPos + BallSpeed;
trD:s }       }G*vi9s/s!E%f7ah
   else if (xDir == "left") {"RDGtg~ ~S6]
      xPos = xPos - BallSpeed;
h'aflw$^Dqh{       }
-E5f8T _0S7K7vNd    else {
2GR Ve I|8^"S@       xPos = xPos;
F2C q5Y _w@       }
a wn7sV)Xm    if (yDir == "down") {
o?"u+C{-p5k       yPos = yPos + BallSpeed;
6{K7P8O'\` f7az       }5\tv&T:W"x6u)m
   else if (yDir == "up") {(P*K5V w6V1g8k
      yPos = yPos - BallSpeed;f/n/M f)W l#TfT
      }{JS-s#V5^@%O
   else {'P8jx!x!fAcE
      yPos = yPos;
(EmOh1r)j       }
3s H_p0g6z    }
_@)mT9y3b$m 1d/wysx;J\A B
function hidetext(){
VB5M4[df+d if (document.all)
jX9jug(h9h supertext.style.visibility="hidden"/D\H"m9l[ Xm7N z x)fm
else if (document.layers)aR5|A!rp E
document.supertext.visibility="hide")s^"x p)a f%bR
clearTimeout(animatetext)N1c(Iu X8l9OH?
}
N:~/]tb,c/N jXR+a!F h
if (document.all||document.layers){
AxSCR-wj.{ document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
7^zb.JsU0z y window.onload = initializeBall;`)Lj"h*q _$u.ecC
window.onresize = new Function("window.location.reload()");
h7K+c5UY6C H| } jq$l$g]@
3h!e1xYj4aE
</script>

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


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