捌玖网络工作室's Archiver

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

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

<style type="text/css">
$z"L;hm,fV*A #supertext {
R+tG/Y!\9c1\?;b U position:absolute;7M5W e#C!omAJ
left:0;
m wy w| top:0;}(v7F}g;o
visibility:hide;
|A){K2?t"A'Q-n visibility:hidden;|Pv!}#h9e@)L
}'p;yv j(Ga*C(s:V#I
</style>6S&\pMh4G)q9d
<script language="JavaScript1.2">HR!I"qmp
<!-- 改变下的字体的大小。颜色-->
a!DF5Q@"s var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
+b;S~ _'P!D-l var hidetimer='';b^1{!\ U'__:g Yq
<!-- 改变下的弹跳速度-->$jEBu:J-l9[0{b-\9f
var BallSpeed = 20;
v'{Y_P var contentWidth;]@_)JV/{kO
var contentHeight; Q8{DD ^ c:nHS
var maxBallSpeed = 50;
$AOj%yV u RQ-n Z
(Qc9T,q7G|b l
/W+_9D6g+kq n z var xMax;
-j~y-m*Aq)h*z var yMax;nsaAZ/V7_H
var xPos = 0;pT F[al G|3V
var yPos = 0;
,Z)m/e;WLP9i var xDir = 'right';
]lv3G@us u$[A_ var yDir = 'down';"XIe9{| R
var superballRunning = true;:i5B%[:CK-RV1v_0^
var tempBallSpeed;
Lc7SiVX var currentBallSrc;
4YrWw2f3}e#W var newXDir;
q6R0Q@T+]-D5N[!]-V var newYDir;N%\m6tT

/tV Uxo(T y$f3c function initializeBall() {'Q w:aD:O)f {
   if (document.all) { v!YHb'iFnF \-o
      xMax = document.body.clientWidth
2pX|%kiW exgy.}       yMax = document.body.clientHeightm4U PXiHg
      document.all("supertext").style.visibility = "visible";:ER8ttfT*h.m
      contentWidth=supertext.offsetWidth
4\3S#{ M}3u#D       contentHeight=supertext.offsetHeightE)iOhL9z'|4N1j3d$B
      }
|Ae%_3{g0ZB#N)d/]    else if (document.layers) {
9l"KpEt1r8qM7^6n       xMax = window.innerWidth;
9y'G#Zb C9wx?M[       yMax = window.innerHeight;
&a$NwF&g!{7b'v       contentWidth=document.supertext.document.width4b&{ v(t'Q(g+~
      contentHeight=document.supertext.document.height
6~8R'X2}Ju)?6@       document.layers["supertext"].visibility = "show";
-I|nN0G\1}'{I0aP       }
{IQ5P? j!XL    setTimeout('moveBall()',400);
vk;J h!re r D`,K^]    if (hidetimer!='')S&P!At?~CrQJk
   setTimeout("hidetext()",hidetimer)
4X)U K7dG#G~    }f f/KO%[oCK)Fc
6u2S(B1E i8l
function moveBall() {
(r5Wr$^1{H%u*]H    if (superballRunning == true) {
3y;As-Se8H7I$uJ*^j       calculatePosition();%c ZB!lO:C
      if (document.all) {
9D(tjZ"W ?          document.all("supertext").style.left = xPos + document.body.scrollLeft;
p2[ z`jG          document.all("supertext").style.top = yPos + document.body.scrollTop;
,l`#]C:Zjs J          }
,G,x2e.mK)_       else if (document.layers) {
3Q"NrA_:^:q`-?6c          document.layers["supertext"].left = xPos + pageXOffset;
*~_0r/i&P;`i+gN W dQl          document.layers["supertext"].top = yPos + pageYOffset;Zo F"[ A
         }+Z.Ac;I@
      animatetext=setTimeout('moveBall()',20);
4O[._'B ~p-J_(Sa       }#z&@3IPHv|t
   }
(m y`Q/~"D-eD _
4{@By9R@3P function calculatePosition() {'HDw3vR F"bdD
   if (xDir == "right") {
c} t,U;ffVs6f       if (xPos > (xMax - contentWidth - BallSpeed)) {
'TDo }pQ4PJ+x          xDir = "left";
5hx L~&G.fMG          }i!R9C|.w|4{3F
      }2e Q?k8M[j
   else if (xDir == "left") {
+nX&azb!S       if (xPos < (0 + BallSpeed)) {Y4z LrL(W8q
         xDir = "right";8r!Dlp-CM R
         }
B:I{?6p       }
+a? cH{&N'E0r;p    if (yDir == "down") {
'no$}Ji&C$q9iM/s       if (yPos > (yMax - contentHeight - BallSpeed)) {2ZOR-myU ZS
         yDir = "up";
J8{d!t2~ZZ`%M,g0S          }
U9b"h/Fk       }
O+Sg \L9Ae+k    else if (yDir == "up") {
1i6j.w U#aF%Ae;_/f       if (yPos < (0 + BallSpeed)) {t `*ZSt0cG
         yDir = "down";
+n9R3o1rf]-C(j          }
9hv6c SI.u'~)o       }
ll-n.Qv7c    if (xDir == "right") {e`XPf#|Z
      xPos = xPos + BallSpeed;lbmy-naG}|(V
      }Y6{8d0R^|\:H R
   else if (xDir == "left") {zz-R,Y K]'f
      xPos = xPos - BallSpeed;
$X.k(UQ"R0sN.\ L       }ls {5BIRb*U:^T"|
   else {IME^ Y2ym+Cz E |3KJ
      xPos = xPos;&B {!B^.c\W!oH
      }tJ)yV9{!Gr
   if (yDir == "down") {
'Nj&P3Zd1tT       yPos = yPos + BallSpeed;
x2Y\L2f,@9Q       }
z/K&[tu;P!c3`)R    else if (yDir == "up") {
._3yx1b"Xsyc-U       yPos = yPos - BallSpeed;w;IE2N\JT'{$c&EI
      }u*Q(`:[#j(Mdm
   else { nvR4xml'R
      yPos = yPos;
ALe&{5O&HB       }
0~uZU.S%pf`x    }
1MK aQ%s+s
D.IA4y(vPvl function hidetext(){BU3Jf O!\ O
if (document.all)2v1[HMX%@$Pa+\
supertext.style.visibility="hidden"
+w;t G/_&z@x%B else if (document.layers)
Il_6?WcZ document.supertext.visibility="hide"
,g3a [SD'g clearTimeout(animatetext)@)x\F*i ks/D
} k+`)ic3_$YK0e h,tW
jd/Sq Biu9o EL \
if (document.all||document.layers){
7HK?Gjw`pv document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
'uB/X}!Zzy%| window.onload = initializeBall;j#F&_ Q!t.Bh
window.onresize = new Function("window.location.reload()");
)Vb tD gz$N }
'Tuq ip }s!xb Wiu
</script>

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


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