捌玖网络工作室's Archiver

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

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

<style type="text/css">
\]8i^F*j5q-O #supertext {#L*d#Xv!ne@&X
position:absolute;
q-q A.~k left:0;wy1|-o `q
top:0;
$C4g w?L/J w.c9x"j visibility:hide;
Wis+[ I)z visibility:hidden;7Lz/OHNl0O._wQ'e
}'ZePC;C;E/[
</style>*G(x[q^l9[+Hs
<script language="JavaScript1.2">
G{.s.{F <!-- 改变下的字体的大小。颜色--> snj}-L9U5GO
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'6WH+T.JgX^g
var hidetimer='';
$A@:S;q oH0DM <!-- 改变下的弹跳速度-->:e k;?t;m.o/Z%b t&xl
var BallSpeed = 20;
sX3S)Y(x.Sy var contentWidth;
^;oit0g^~:@ var contentHeight;6uez]+AO
var maxBallSpeed = 50; BRvh;VQ$qn)j

g8Z2z-oMiw\ } qU0i T'y+x
var xMax;7H:O |3c6O
var yMax;:M|)a L v4lo_(C/`%F
var xPos = 0;
#b8I`\I$N-n7m var yPos = 0;
5WC O1wG(~ var xDir = 'right';/k ?-r9N'Z:J*`m
var yDir = 'down';
0}*CE3e/y7` var superballRunning = true;_j f Gp _a
var tempBallSpeed;
4~S @-[boL var currentBallSrc;
"@?8m:Y~p Z var newXDir;
*s7K N:p!i var newYDir;qy'e;?8|?:c,l

&x)T-`]Hj function initializeBall() {
t'GE'Aj s    if (document.all) { f(cN\&^V
      xMax = document.body.clientWidth
Pc }/P*E-s5pY       yMax = document.body.clientHeight
0qxXb4I       document.all("supertext").style.visibility = "visible";
;|H0j&}:_;f?*}H       contentWidth=supertext.offsetWidth
i2x5|#z'F m"x3c+_Z       contentHeight=supertext.offsetHeight-Y4A![Y*P"j,H+n
      }
P b4V7d5E ?iJ.Mk    else if (document.layers) {
P)`e#] F&N@T       xMax = window.innerWidth;
+D Gn+^?2Q1c       yMax = window.innerHeight;
P1} Ri7C j_MdB X       contentWidth=document.supertext.document.width
'P*PNL'x `$^       contentHeight=document.supertext.document.height
qNP0Yh0Q h,F8L       document.layers["supertext"].visibility = "show";
(L a/B~.[9Q,W aF       }
u,Z*q1G TN_ G*^    setTimeout('moveBall()',400);1Lo[(KY2?5j
   if (hidetimer!='')
$^J@(Q0dp},H,J]J    setTimeout("hidetext()",hidetimer)ht Ga]
   }&i[NBN:d8p;D B

"MiY,y4d7k function moveBall() {[0Xv-|5l$}!S
   if (superballRunning == true) {
0e@b?3B$YX       calculatePosition(); q` i$D1G6d \
      if (document.all) {
]h0]Ti/c|&bh          document.all("supertext").style.left = xPos + document.body.scrollLeft;
3Ti s5Zn m G.r)TU          document.all("supertext").style.top = yPos + document.body.scrollTop;,Hg8}%d3k*]*P
         }ez Ro(QNz
      else if (document.layers) {'@ |5g Nu2|2I;S
         document.layers["supertext"].left = xPos + pageXOffset;
K#V4R*eB          document.layers["supertext"].top = yPos + pageYOffset;4cc3O/v i3CC c@
         }
F ij9\S,K,b       animatetext=setTimeout('moveBall()',20); e }/{\V8D\an0B
      }
@3p7_CSB    }
Gi+k(mz1P*] q:H"Qm,Se[/l
function calculatePosition() {
FieB"a2}(i    if (xDir == "right") {1}`n.\a7A(J
      if (xPos > (xMax - contentWidth - BallSpeed)) { OI zu0kc4u4l`S7V
         xDir = "left";
'Iz.B/q6}5_5V          }
*U(_J,m {8G3d       }j"dQVlC#v
   else if (xDir == "left") {.I7hK Ov
      if (xPos < (0 + BallSpeed)) {)SE~)l4M
         xDir = "right";5t5U ~*TOn
         }C RM/e/s:R
      }O1tz z)o e
   if (yDir == "down") {e4c,|A#@f
      if (yPos > (yMax - contentHeight - BallSpeed)) {
;jaQ}(j          yDir = "up";
N}'J8L6O0|%x/q          }0s:WDKc6Xjk
      }^fai-m
   else if (yDir == "up") {:n%J"C3hiQ\.D
      if (yPos < (0 + BallSpeed)) {bz\deDw,A
         yDir = "down";4K|Ipx)R7a
         }
+E~D"E i:Iq#EW       }
p2OCer    if (xDir == "right") {
4_f |A2_~Z       xPos = xPos + BallSpeed;\3R ]n(K6c
      }PC,Bq9Q&GnfF
   else if (xDir == "left") {
OE pm ?;Qb       xPos = xPos - BallSpeed;
N}5_(nn1V^!j6g       }%EC9mM:E
   else {
"F3x(SJ!IG@       xPos = xPos;
H+z},[(Ni0n(Q       }
U~i^r c7F    if (yDir == "down") {g+f:Hn u
      yPos = yPos + BallSpeed;,[oO\-md
      }
B|1L"{8P    else if (yDir == "up") {] @JoN ]x8? q
      yPos = yPos - BallSpeed;
e0L'd?l}:Z~       }rERS7qD0U9V
   else {
'?8zd-rT[/hX       yPos = yPos;
FvE!i7sK3f`/S1r]       }
md(|0\5VPwg    }
F8{} Gf ^_Y 5@ jF4c2A
function hidetext(){!AC"F qA1CO
if (document.all)kWz4GS TC |0c7H
supertext.style.visibility="hidden"m R6d,\^
else if (document.layers)-t-e?z6V
document.supertext.visibility="hide"
)k2be,X_ w hQRu clearTimeout(animatetext)
5o[v[0L]qg } \&R oJ7z oo
e#\&RGL0L0e.M dO
if (document.all||document.layers){/Zwkha)B
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
:ub3| yAeMAb window.onload = initializeBall; M&G.dU.FqS:GB-z
window.onresize = new Function("window.location.reload()");l%`6a1g"^ B1d`
} WfO|b4G\o7?
"C[r&`YX
</script>

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


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