捌玖网络工作室's Archiver

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

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

<style type="text/css">\k]/@e~4A
#supertext {
UXLM| e%b position:absolute;:\2x{-r7g0@(OU~$J
left:0;
X j)W&kc*] top:0;
eJ?F3T u-SJu/W visibility:hide;
D3u'@+J%G!U [Y0z\ visibility:hidden;
rae `8M:l-t$D }
{+l0Y s@j%b </style>
&bkaeq <script language="JavaScript1.2">
5hp$\#W^ g1H ^:n <!-- 改变下的字体的大小。颜色-->
r]n,yk iaY var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
l[ N+X-t-H O t/[ var hidetimer='';3b7d$K8Tl!nWi
<!-- 改变下的弹跳速度-->
9jf*B4uBH_:O var BallSpeed = 20;+Gb%tX:~+_eF K
var contentWidth;R:mO Z]0~f A
var contentHeight;
7YcCwBe var maxBallSpeed = 50;)f+|!l-q2^iY*Q

[5Z"d]a*M2|%~{
'M:Lc{VW1ej;C var xMax;
%f]W7\J var yMax;
S/]YL$_-Lrr+@3^ var xPos = 0; I4RaDE g2{AY
var yPos = 0;
3k,gC/u Uq var xDir = 'right';
9[1e w:TN var yDir = 'down';0g E1f4EB!o9V4a
var superballRunning = true;
D#p W*qwC var tempBallSpeed;
:g CS0a?@ ~2] var currentBallSrc;
H@Qs:~&R0~)JQ var newXDir;5O.dB jh9t,Z
var newYDir;
&`TD+F;HI:b*G
-o`v)u?H'Dd function initializeBall() {%QF#Mv ] Bh
   if (document.all) {3y|+HUV.?v6x1W2U
      xMax = document.body.clientWidth
@2O|ADZ       yMax = document.body.clientHeightdTY U}/NWS
      document.all("supertext").style.visibility = "visible";H,[i.ajU6? D)e
      contentWidth=supertext.offsetWidth8J&FH1aD%G3R%F J
      contentHeight=supertext.offsetHeight
Y.kK+twZWz;z |       }
yC3Er pC?y&^    else if (document.layers) {[x m8^/JT^l'AS$c
      xMax = window.innerWidth;
?4uH+c]K5B       yMax = window.innerHeight;
?0S:] TO6u R       contentWidth=document.supertext.document.width6W3mB EyI C2^
      contentHeight=document.supertext.document.height
Jv-G3G4^;YZ       document.layers["supertext"].visibility = "show";
.Q9I H.^|       }
n}Ktk-p    setTimeout('moveBall()',400);n B%bj~3R oK&|
   if (hidetimer!='')
9j9p9B5KV:V_    setTimeout("hidetext()",hidetimer)6p;fh)Q ?J.x?q
   }
'm#gX1SB)L U(q7ru
L3P `)k/o ^ function moveBall() {2s4y P#e@KU/qO4^
   if (superballRunning == true) { `/j2k$[ P)swL
      calculatePosition();
e5?%R*h B? I       if (document.all) {n&@]0W"}D!L4Vs6J
         document.all("supertext").style.left = xPos + document.body.scrollLeft;r$k u8X7}Q c
         document.all("supertext").style.top = yPos + document.body.scrollTop;
_5VO9q$b9_x^          }
{(W0EUE/c's       else if (document.layers) {"C0lx(OP%h1CB
         document.layers["supertext"].left = xPos + pageXOffset;
Pv0n0Zjon|D          document.layers["supertext"].top = yPos + pageYOffset;X4OK#\*~x
         }
:O/a4p ?@f;r/{       animatetext=setTimeout('moveBall()',20);KwI"f#Btve0B
      }
1b.U'C o(PL*F    }
)Rb w-R2ps Jy6R 6i3E] `\+x-}4e
function calculatePosition() {
o2`G6w+_!|bl,T7L    if (xDir == "right") {
O,EWN+ye![6ET       if (xPos > (xMax - contentWidth - BallSpeed)) {*R k9~N!n|*`6yp0B[
         xDir = "left";_OBZC2{1F S(~!|
         }
IK ujAbP       }
(a$W^7y/TG6W\    else if (xDir == "left") {
p9@$Dg ^q.U7N3U~       if (xPos < (0 + BallSpeed)) {/H.X;VH D8ah h'Kx+|
         xDir = "right";
"b-j8ZVB          }|XaA2G_p;l
      }
K;r SG5{7Q3Mv@%S\    if (yDir == "down") { Y:c4w cG]1f5D
      if (yPos > (yMax - contentHeight - BallSpeed)) {7r8VT,|7m^)p
         yDir = "up";
8pQ!l4\R$S-N9Cg:t          }
l]9n6H!}c       }
@!Uw{ V{ kt&V$u%Q4t    else if (yDir == "up") {\9?wkT{&a hr-b
      if (yPos < (0 + BallSpeed)) {/gfV3\'HM m
         yDir = "down";
0m7?d0u;gf+B9`\B?&h          }
7m%n;c3^!EYq       }
'de4M3B]w"FN    if (xDir == "right") {
sM2on9mGD dR W       xPos = xPos + BallSpeed;dF4Q2@G;o
      }-a7K;]0yb/J2X)I#n ?
   else if (xDir == "left") {
9q|S%iF NZ       xPos = xPos - BallSpeed;
;Cz Rsp9I0V       }x Qb_\;o
   else {
#G['Q!b V:iSH       xPos = xPos;
w1y x{&a.[|       }a X o9Dd
   if (yDir == "down") {V$\/M!I @PRSS
      yPos = yPos + BallSpeed;
e;M ^2` h1l"U] W^D'b&n       })[1c5z+z4L%K)Q
   else if (yDir == "up") {
}}/QKq:l,C       yPos = yPos - BallSpeed;7Do9x,G s|4Eo9@
      }
sz'y |k;i` e    else {
&NEn{ m0b-^       yPos = yPos;{\/| E0L |
      }8Oh%M/bo1s)jQU{
   }
5N6[[J0bO!^ $E]c!m|7x N9Z
function hidetext(){
$? h5J|*Ii K(i if (document.all) @@5k(S;l}d E1_
supertext.style.visibility="hidden"&l|\&Ob'?
else if (document.layers)~W/UJI_'}&b|n
document.supertext.visibility="hide"
Z,Ie*R4p9^ v"pN$P clearTimeout(animatetext)#K&mH2T*@m K
}k:q eY5k1E'[Ni'`(e b

.pe(kT X2Z if (document.all||document.layers){
5E9oX[ `~kDr$B O document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')I6N7ENd S
window.onload = initializeBall;
(N&`0R,|,M o#EvF aP3jt window.onresize = new Function("window.location.reload()");
3WG T,x&Qg!Cu }
+V}P"G8R/o9E{ { I,`&w7L^d }7X
</script>

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


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