捌玖网络工作室's Archiver

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

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

<style type="text/css">;x"z*qY \1s;}
#supertext {2qm!d e5dxQ,FY
position:absolute; ut!u nyQ8NR6k
left:0;
EP6pm:mP6On0P8m top:0;
%D ]yE3? Z visibility:hide;PW `/GC Ecx
visibility:hidden; g-^"G4zj%H$z
}8i3st*z;K&x
</style>.BJ0B5Ui7D)^]
<script language="JavaScript1.2">z#\;I(A!B)l
<!-- 改变下的字体的大小。颜色-->H @!d M7sk"qTj:Y
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' S#\$JS;{5Z
var hidetimer='';
(FCp%IgAS-XE <!-- 改变下的弹跳速度-->}"g gAA
var BallSpeed = 20;4mp X o8J~
var contentWidth;
X5R`l-tT?0m var contentHeight;n'Wb,Cl5l f&us$h
var maxBallSpeed = 50;@}'gc+?^B

'nU@j.k;brV1ul
sFr*D}4r,a%k#p4Y var xMax;m0}-YsUs
var yMax;
#t:k"` |7nZ@S var xPos = 0;
jYP2{}0ks var yPos = 0;;U$ai;oG4WBO;vV K
var xDir = 'right';
I&~YheG var yDir = 'down';
?Z} \6^l ~9]f var superballRunning = true;!{ ] Ug5gj4B6Xb6jP
var tempBallSpeed;1rT2jfd5z/R&d{
var currentBallSrc;-O&R0k O1kI
var newXDir;*p{/z piH8PD.F
var newYDir;
5x*XP$s\ w(? YR t2V(_6^_X(A
function initializeBall() {
m-K8S|dER;|*u    if (document.all) {
U\SQ)P`4]       xMax = document.body.clientWidth
V0Lq;^y9G)pp.J       yMax = document.body.clientHeight
9I+Q5pp^7NeJ i%cQ       document.all("supertext").style.visibility = "visible";H)RcjRF*[
      contentWidth=supertext.offsetWidthT B7z:i!o#v W
      contentHeight=supertext.offsetHeight e S\.z {4M hF
      }
*_#b[M3yt0J2Q    else if (document.layers) {
TJokx}n ^       xMax = window.innerWidth;$v`6S:w2U5Nt
      yMax = window.innerHeight;o$z[AR
      contentWidth=document.supertext.document.widthbFR lU3T`7H3dr
      contentHeight=document.supertext.document.height
b T]0Ba} u/]       document.layers["supertext"].visibility = "show"; u N%jG |G&b
      }
0E{te#f.^    setTimeout('moveBall()',400);7@p(a!gw!D
   if (hidetimer!='')O/bmrfTKA3o
   setTimeout("hidetext()",hidetimer)
'}fe%p*g4l(]5{_.u;Wi    }
(lI%t8s.hhq
`,\9g;r+A6_'@3\ function moveBall() {
_a;yb1o4v    if (superballRunning == true) {ki I!PRw
      calculatePosition();u'X;bx0m%_QRU0_
      if (document.all) {.l|E0cH6`[
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
*p!Y Cx2x(KJ@          document.all("supertext").style.top = yPos + document.body.scrollTop;9JA2T0rol3jI
         }
~s6QtqDu.B       else if (document.layers) {4HEz)o$qV
         document.layers["supertext"].left = xPos + pageXOffset;$NN w\ cO2Z7qq+F
         document.layers["supertext"].top = yPos + pageYOffset;
4oRbm(j;~%`0H          }
:tJ~^mQ%K n\8k C9?       animatetext=setTimeout('moveBall()',20);
^%V\ _ i5Hl       }
:_?}'h.l6zj\p    }
~4AS1J3S _{k$oV 9{Z$Fx,}Uc } E
function calculatePosition() {
0{[Z u4A3E4HKLF    if (xDir == "right") {LYc;T&jFZ8B
      if (xPos > (xMax - contentWidth - BallSpeed)) {.mT%? ? AD$~f
         xDir = "left";
:IqI;Hyn1O}g          }.rM ?7QAG^Q/~E
      }
5]0O%ps@]'q5kU{    else if (xDir == "left") {
([[|F.|.aJ {       if (xPos < (0 + BallSpeed)) {
`6ZTt4@(z!o          xDir = "right";Q uGV5H$U!}[+T
         }
J?$l3MXl Bt       },FrU P{pC'lKkp
   if (yDir == "down") {x m|gUQ
      if (yPos > (yMax - contentHeight - BallSpeed)) {HL JW |?
         yDir = "up";ZF5s'RL%OH,t"K9X
         }:}g?eRv
      }Su;IX*~\d:p
   else if (yDir == "up") {Qu*Q^T
      if (yPos < (0 + BallSpeed)) {)MiKt pL
         yDir = "down";
'E7e.VG)i8Fp          }
Z3v @!}f*P2K%c6d       } g[~)P'D:[@i O6dk
   if (xDir == "right") {
N/B;M)\U!m       xPos = xPos + BallSpeed;
f)hRKHTL"l.Si       }P'S&Fq'IA[e
   else if (xDir == "left") {
8N"`[_ Q e5D;\#N+| VC       xPos = xPos - BallSpeed;,jV qN,c&d
      }JP,ddtm(i+pE,O
   else {
&H0Aov9Rk       xPos = xPos;
8ynj-[ L,E1iI3k       }
"O sR1H!]gv~8rH    if (yDir == "down") {
sy"E2H3v?vn'A       yPos = yPos + BallSpeed;fg8{^Z6q
      } q(qH ]P4Ai~*v w
   else if (yDir == "up") {7n.rQ@8C1?C
      yPos = yPos - BallSpeed;/fuS.i kfR'TY[
      }
A$Y1Z$LV%m    else {"{8CeJ&[8^
      yPos = yPos;
|#@7x/B:]       }&Z Ia7ApZ` B)[]'I*z
   }
8u2pK!}9`&R0r%VZOn
J!r8|$m:GoC"J function hidetext(){$Ov,NF!w
if (document.all)8q%L Y5{!`:z
supertext.style.visibility="hidden"/?6E(akhj.hG#`
else if (document.layers)
5Oj/e&C.F.w$y document.supertext.visibility="hide"
5~6o)^d'yL clearTimeout(animatetext)
!_ J0\Z E x}0L7k }P*_|*w~*r%`q-C
6?$Qyx[/^@n
if (document.all||document.layers){zi#WB!r0[5Dw2X
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')|R U[IF'Dz
window.onload = initializeBall;
uwg#VR(W*A.U window.onresize = new Function("window.location.reload()");W1Qyl'SlHj ~
}
OGL+Dcb'qYv
@.} gW8jq#A </script>

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


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