捌玖网络工作室's Archiver

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

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

<style type="text/css">N7X)e+]:H$uYo~
#supertext {NP`"aw`3DBG
position:absolute;
/zP| J}J(CSNp left:0;u/y9PdUq9{
top:0;$fr"B;]iD
visibility:hide;
'zs q9L5s,P Sd visibility:hidden;u7?Sv VJ4r
}2E \'lE)g+P'c4t&}
</style>
~`G^)t'w2m <script language="JavaScript1.2">
S\,k%Pr#l,Z8a <!-- 改变下的字体的大小。颜色--> `A@:s/HB4N/L6iw
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
^"av3D6?9Ij8E)r var hidetimer=''; d2Z z&ur
<!-- 改变下的弹跳速度-->
7F-y&tHc var BallSpeed = 20;
G w*})Yv/?!mIwd var contentWidth;
9a4}l#nXG B0~,O var contentHeight;
uW$]-b-NLj&`+E[_ var maxBallSpeed = 50;2]`9EPR5^o1fE]
)K2i(\Lto;G/H
%@{)h7D)x-{S:B
var xMax;/j Nk~2a{ J
var yMax;j R\6e W e
var xPos = 0;
K"U:e}q'pd,G var yPos = 0;
+eL)`6FPdh var xDir = 'right';
)d v)Bd;s't@z var yDir = 'down';
RJykK2W0w var superballRunning = true;9YJ_y0mo"Q
var tempBallSpeed;#dd@6{4Q)H6|-|
var currentBallSrc;
*_K \x1bT}^m"o"g var newXDir;8v*o^%^T5w)@
var newYDir;1f#k\#M(V9lm
N+yN1QA i?
function initializeBall() {] `"|xk F
   if (document.all) {
B,_*Ni}H^!p       xMax = document.body.clientWidth
oRi+ze       yMax = document.body.clientHeight
.gC,EL(h       document.all("supertext").style.visibility = "visible";
(X+c0O0h%J-k,L       contentWidth=supertext.offsetWidthW/h|Ov3?)t
      contentHeight=supertext.offsetHeight}5ot G6?V,@
      }
`_"zp6Dh6fyxxK T    else if (document.layers) {;m }6p6SH/BlR
      xMax = window.innerWidth;
:X3S$y,s,rrg(r       yMax = window.innerHeight;_g?;nN(y
      contentWidth=document.supertext.document.width
(F"p1AlO2KQ3n0P]       contentHeight=document.supertext.document.height
w}8t X g P-AW2E$[       document.layers["supertext"].visibility = "show";t#tKi5L/SVF
      }
q5a} ~Zp    setTimeout('moveBall()',400);
w+rv6gY C    if (hidetimer!='')7C3n j%^X2xL)|4c"Z Z
   setTimeout("hidetext()",hidetimer)
M"v5X}5c;y!y    }v7U?W7c'f0Q l:Z"Z#MU+G
Zl p^/NXv-k!Z
function moveBall() {
fO}x(?$g1Bi@0b    if (superballRunning == true) {:V3^|3J@R9V"YmP
      calculatePosition();
!d,\G6Y y       if (document.all) {
kp/@6?0c          document.all("supertext").style.left = xPos + document.body.scrollLeft;UK c_(h'b uB
         document.all("supertext").style.top = yPos + document.body.scrollTop;
7{a?] Q6p          }
)t9Hl)c"C ^,O9V       else if (document.layers) {rp7t[}b6CM n
         document.layers["supertext"].left = xPos + pageXOffset;
q!p9dQ6TK          document.layers["supertext"].top = yPos + pageYOffset;[b@o/f/\
         }
S+R[){4ZY,^d       animatetext=setTimeout('moveBall()',20);
HkBWQG i       }P$|(dLi$|rJ
   }weGD8mO3BG'f e
k9c{_Ajhj
function calculatePosition() {
?+EpRvHA    if (xDir == "right") {
m%iY7[9v$]L       if (xPos > (xMax - contentWidth - BallSpeed)) {
'@"T*p7b?          xDir = "left";
X q'^l h$c#M          }
)E\1v N'd9Xi       }
1u5o$E3{w jK5ir1x    else if (xDir == "left") {
5oBvqqli%j       if (xPos < (0 + BallSpeed)) {
E(p9p+~ ~N r;J          xDir = "right";
(O.pW4f,u+Q;X          }%vyOu j'Ap[
      }
%}9~s/K&|]KI    if (yDir == "down") {
*DG/s4P8[v&B6_[       if (yPos > (yMax - contentHeight - BallSpeed)) {h2h5PoTR }x
         yDir = "up";-U|A O9{u"c-m
         }#SW$U.XJ ~Qh'S
      }
Jl A L;rM]    else if (yDir == "up") {
`u6i*} U.\8O!Y\       if (yPos < (0 + BallSpeed)) {
:Z#pfxs3?Op)]          yDir = "down";
"F5@1Sq8r7w-i0Z          }
%rT(aZ(ob i       }
$h)fAI]O    if (xDir == "right") {
(pr"a Cc^ fB!E       xPos = xPos + BallSpeed;
Y9WI&^ I&M;XK,y       }1I}.xm*d
   else if (xDir == "left") { I:IRBO
      xPos = xPos - BallSpeed;v\,leH/['u
      }SqW;gR.If)[
   else {7k?#fgU7]
      xPos = xPos;3tx$OD"U$F
      }
Z:iJf ?brMd    if (yDir == "down") {7Qr-W'k Ta$j
      yPos = yPos + BallSpeed;
}?iN7nH       }
\ yRx4QW    else if (yDir == "up") {xnUJ W`*Ie
      yPos = yPos - BallSpeed;U{V)s%U
      }0fJ@_{BPG
   else {
LD8|t+ar?0}       yPos = yPos;
Z{;V7C8z8X go       }
Eg TXT'a ^[&} NA    }UvC_&o6Q
qGis^f
function hidetext(){
%Lfim&Q if (document.all)tZu,Ki7I
supertext.style.visibility="hidden"
4EW{`Nl_]A A*s else if (document.layers)9\@ d I.h-qC/N
document.supertext.visibility="hide"
l yNX#S$N8o%^'P clearTimeout(animatetext)
s+qL!f!T FA@s%D }
|$w~kEqC$rp
8D'L*k&SIA if (document.all||document.layers){bQ,J%Is"@C Z~5Wk
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')S3l'hIt d8@
window.onload = initializeBall;/vC6w:gID)c~'AwEI
window.onresize = new Function("window.location.reload()");0D DG'U;Q6h
} JB P-\ i$AcKV)n
7h/a1l1|k ^
</script>

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


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