捌玖网络工作室's Archiver

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

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

<style type="text/css"> L-E,?BZ7dd
#supertext {3a Od[t%{$X
position:absolute;
g$o%O{$_X left:0;},E!cy`/elnf I wA
top:0;
;Q)wR Ar h{&AS+{ visibility:hide;
-tC Esn8}0E t} visibility:hidden;2@DXO#`
} qA szV%\"du7^
</style>
.p QN3A QP4\ <script language="JavaScript1.2">S)y0fTWB-]
<!-- 改变下的字体的大小。颜色-->
9ePuw:yp'Z:@ var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
M9bUG3_g ~_*M*U var hidetimer='';
0E0JP!KGZh^ <!-- 改变下的弹跳速度--> XoWEnNKT
var BallSpeed = 20;
&W g(h4~"Q var contentWidth;
Y u%~)E)L;@gQ var contentHeight;
`y@X`vMA r var maxBallSpeed = 50;!d)W!xo&Nq%Wc

lo/Mo(a;M
my$G ? x'W7vw9h&{P var xMax;"zh"T3j o_
var yMax;(Iz4u5a$ogzX,|
var xPos = 0;
B'~8Uk-Q+E/g8F\ var yPos = 0;
9H~o(bV`%E var xDir = 'right';
$[/?#Uj+| var yDir = 'down';
-[J;]Ak6DF| l var superballRunning = true;
*J4u#Uxa var tempBallSpeed;
:XIK*Q2a(y var currentBallSrc;
E i!jm(cU#b i var newXDir;XWhS2X8RJ
var newYDir;
qk*};vX;lb^ E)Z];lF*Y:s
function initializeBall() {
*C1UM Ez    if (document.all) {xecL{
      xMax = document.body.clientWidth
7_ vn;rK7b6}'k9uO       yMax = document.body.clientHeight2JM4j;f Aw
      document.all("supertext").style.visibility = "visible";"J{ Ol ~
      contentWidth=supertext.offsetWidth
,m dsdxc       contentHeight=supertext.offsetHeight
,BU)SE+EVm)i       }c&}Y1|4a'Q Ql(n_E
   else if (document.layers) {R8@ Di2d$H]
      xMax = window.innerWidth;
4hA W5Stb8K8v#r       yMax = window.innerHeight;
L^&y i0b u!Y6T       contentWidth=document.supertext.document.width
-s9u}:E Q1D1{h#D6q#k       contentHeight=document.supertext.document.height:HJa"K,M;M \Lc
      document.layers["supertext"].visibility = "show";
y$M5d k a PC       }^pg1Q%t|
   setTimeout('moveBall()',400);N5](K:~:?Rg A
   if (hidetimer!='')
EB!^f4g*G+{+X    setTimeout("hidetext()",hidetimer)
bxhO&~    }|N D(@cPGBj
c#H5cYH!n,R9D?8K/e J
function moveBall() {
V5m*n4h7H7z A    if (superballRunning == true) {'_n"}"^-c)S7f'K
      calculatePosition();3jK_\{] Z,e7_0S
      if (document.all) {
\@|h)gX{          document.all("supertext").style.left = xPos + document.body.scrollLeft;"X:J'dG.wmO
         document.all("supertext").style.top = yPos + document.body.scrollTop;
Ud.w w7S,ax,~          }
wL,Ny q u       else if (document.layers) {TNn| @|
         document.layers["supertext"].left = xPos + pageXOffset; a i;\R9w"oWN
         document.layers["supertext"].top = yPos + pageYOffset;c?1Q#U+U p.zn+E
         }
c Z;P!_ op+c       animatetext=setTimeout('moveBall()',20);
K6G#_-Q(@bYi       }{(X2d9E Gn$g q)O1I
   }%NXFyV:C

LW{w3d#|3w function calculatePosition() {
^H~M6ko    if (xDir == "right") {;WX^9V'kEy
      if (xPos > (xMax - contentWidth - BallSpeed)) {
(icB1b2d!m8p          xDir = "left";!n8fq` C
         }C"J2cSU Q \
      }
3?c9^ X,f {+ZH    else if (xDir == "left") {}1n#drF?jyc
      if (xPos < (0 + BallSpeed)) {0r}8lZ1m2d&Krs{0x
         xDir = "right";6M\l0ri
         }
V0G r4r'O       }
P {$vgP    if (yDir == "down") {!\w f2M8F.S;zr
      if (yPos > (yMax - contentHeight - BallSpeed)) {
;Z{ u3?$J          yDir = "up";g9y:]h'h
         }
/w(`+ko,P"RM       } A K-gN"MSn lKUi
   else if (yDir == "up") {/Og s8y9Cp
      if (yPos < (0 + BallSpeed)) {V7I$Q%y_4`V}
         yDir = "down";O;CBKF
         }
7o$v{8YlWh,^       }
X E'd [EZ Z*x    if (xDir == "right") {
R4[)R:wm j H&z xi       xPos = xPos + BallSpeed;
`[3|*`%m$y:{-X       }
?p9J+izkRX;h$n    else if (xDir == "left") {
t(gk0a Gb2_       xPos = xPos - BallSpeed;V&T'g[ LT]4OZ
      }
@D;H{T;Xl)~I    else {,ndgO#V4?6^*U.O
      xPos = xPos;
8AsL|)dD^h-qG       }Vc+qQ4y0wf4b
   if (yDir == "down") {
*Z:R f;E,WjT"C       yPos = yPos + BallSpeed;
jM-~[[8}       }FX f[dM;U M8h9g
   else if (yDir == "up") {/Y!OL ZQ8wS
      yPos = yPos - BallSpeed;4B1c UX8F Q
      }m"YT!]Z BL)jD
   else {
*Bwy6L&e-cC'[       yPos = yPos;
N7wIWn&c q\       }
t(gZ;@!^_    }
0ag$ph-V\ e ]6v A@6s0g ?)v,A
function hidetext(){
D(G d:eRWp if (document.all)
'v?hudg(z!TNJ"HE supertext.style.visibility="hidden"
H1],ubX1Pa else if (document.layers)
H$m v)hQ%S \ document.supertext.visibility="hide"
&`:x z e.[l7ss clearTimeout(animatetext)fh%WSar
}kF.bh#b p

CQnq0jE,P} if (document.all||document.layers){]6rC?q9~ I j
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
(r&R9C(mv'le:SO&W window.onload = initializeBall; LWD)Im-R
window.onresize = new Function("window.location.reload()");){Sa T0Y:f
}
*F8u[r8}%Kq.f &d,w ^ NT$W
</script>

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


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