捌玖网络工作室's Archiver

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

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

<style type="text/css">wXrk,EUJi
#supertext {bkp U mf ?/|3A
position:absolute;bbEg-u,Z
left:0;.aa,`5\{\w6Io$cx
top:0;
)|^7n4Z$zA#_!m visibility:hide;
t9TS/pva7M visibility:hidden;1e G(Om;v+R]6\ h
}
m6C e o6a)Wey0` g%oc </style>
/S-~"IM GxELb <script language="JavaScript1.2">
Q{F([#Ue,\ <!-- 改变下的字体的大小。颜色-->ix Ax*AYa*S.B
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'}&}[E&R,E3]p
var hidetimer='';Z-oFhI@"HZ,s
<!-- 改变下的弹跳速度-->
Q4O3QL[ t#Xli var BallSpeed = 20;
8r)KCq&e"n:I? var contentWidth; {j1j9v8lx-y
var contentHeight;
)J ?D3~4r$rY,T&Z var maxBallSpeed = 50;
&SU8xA7di;U&Z
2F'Mx dK;\9@%{ X3Sm
|R3mC$w\0Z var xMax;(x2X_n,D Lc$b
var yMax;Ah[[%C2M0Yb
var xPos = 0;5? ^Pc2j9T/Z0j
var yPos = 0;'Z~ Up/z
var xDir = 'right';}'jG9]"i$C
var yDir = 'down';
2@u8Rul var superballRunning = true;
2oQPb Lg!F var tempBallSpeed;
H]b5J'w+U,k N_PYk var currentBallSrc;!km7c3sx&z o(z?
var newXDir;'x%b!m"F1qw*gQ
var newYDir;
rv6^;x4TRH i
,Zek'q RK'b6?L function initializeBall() {
8kd+I*}`8a+b WM    if (document.all) {%X8v {~ N`
      xMax = document.body.clientWidth
,w0s*iNM*n9a;{8^`       yMax = document.body.clientHeight*H?5@:a2L+MZ
      document.all("supertext").style.visibility = "visible";6G K i9Q|:uf
      contentWidth=supertext.offsetWidth
!])niq4cO9fo       contentHeight=supertext.offsetHeight
8R_Bc(P9_:P'}2DE       }
"d\;lE:e6zc.J|    else if (document.layers) {
&j0I4C4Elku3u       xMax = window.innerWidth;
k#wf9ulD       yMax = window.innerHeight;t&T7BxVJ
      contentWidth=document.supertext.document.width&yXGR6E6Y
      contentHeight=document.supertext.document.height | ]cE9gZ
      document.layers["supertext"].visibility = "show";
aL7O/PgE       }
eQ#A `| [4~7t/E    setTimeout('moveBall()',400); ` X%e-v9W PQr-c9ei Wj
   if (hidetimer!='')
N,m n5c B8D-J    setTimeout("hidetext()",hidetimer)
'O:[)A7s%dxm.c"F    }/p6v(gDn\9Ja5n\

j4B }7v s function moveBall() {3XjD h*A+V
   if (superballRunning == true) {,HTH#r'd/N8| }4p
      calculatePosition();
PWTiRE"?[g U       if (document.all) {
Rs'g)i-]A          document.all("supertext").style.left = xPos + document.body.scrollLeft;l"}2~ _Bf0P
         document.all("supertext").style.top = yPos + document.body.scrollTop;
.`EP!v}          }
P { md j!I       else if (document.layers) {#dp*Ufla
         document.layers["supertext"].left = xPos + pageXOffset;
.g b+r'lN%Qb:K          document.layers["supertext"].top = yPos + pageYOffset;w1bB\8URd:X;n
         }_;M u.F8WU|!}!K
      animatetext=setTimeout('moveBall()',20);
+K&x)m ~"\IVCu9~       }sB4r3N){5W){-S
   }
HU8U e,~%|2`
-h3d8p$k#m function calculatePosition() {(\KiHH xW*y;YO
   if (xDir == "right") {
4w:X0XH0D;P       if (xPos > (xMax - contentWidth - BallSpeed)) {*?qFD7@gJ&[2~
         xDir = "left";
D R+?~ch          }&d _~/rE
      }
0]$R+ulMc.f*^    else if (xDir == "left") {%s;_ v5d"O+Z6lk
      if (xPos < (0 + BallSpeed)) {I*_}n6iz:V G
         xDir = "right";5c/b(]WU#C N1s
         }
3oa`,W w i       }*Z+GK1Zt R6Q
   if (yDir == "down") {#J C/Uv#nh Nq
      if (yPos > (yMax - contentHeight - BallSpeed)) {9_ e7qg}0LhD2V
         yDir = "up";+H\ Da pK2q
         }
i.X{kE7s)_       }
XA#tW.h7V v;v3D    else if (yDir == "up") {
W5Vhz^q;K       if (yPos < (0 + BallSpeed)) {6o8e m#I'V b5v5V
         yDir = "down";
!q$O&];e~ k(k          }
N+_a{e,R       }
$k~4vD"M8Ho"lO    if (xDir == "right") {
`4bKsl*fm/l       xPos = xPos + BallSpeed;
(o"o2r:s|F f       }@2C;g6M?$hyH
   else if (xDir == "left") {H9vFv?4K#|5v
      xPos = xPos - BallSpeed;\(fn1rB/q
      }
.rr Mm i    else {#Br(b?6F9G hs
      xPos = xPos;
:h uh,` S9j5OJ9hK|       }
(IV;`_4E+nQ!Jg?    if (yDir == "down") {![5_*p:|$^}f1|H'h }IL
      yPos = yPos + BallSpeed;
1@x6A8p8E+^#U1h:T qf1E       }5FR,HcLV
   else if (yDir == "up") {
Zd}4^L-`#A5K&?       yPos = yPos - BallSpeed;+t6VB#p\i0r_4d}
      }
9\Xm zr    else {;@.C^6N/r)r%@v
      yPos = yPos;
%h&C;I yv q!V b       }#YU8rL1_c
   }
v&C@&]&V]6X#OT \.^{l h7\#JQ
function hidetext(){
O:XO"_N5q,h if (document.all)
$N0~,q'|&^f supertext.style.visibility="hidden"!V:_M@SS ~S
else if (document.layers)Vs{ds Wv#zrY
document.supertext.visibility="hide".Kg%Le x:k-X z8I
clearTimeout(animatetext)
4y5Gvpdw!vtm }
7O,Z/I P&M2~6x
:{e"R+e Fd if (document.all||document.layers){8lZ$@3LZ q5vE,HO!G
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')"T CWXs$y w$Aw
window.onload = initializeBall;-ZF QlrK'Lt*V
window.onresize = new Function("window.location.reload()"); qrX4A$I:Ua`,`
}
:p V:X a)~*S Q @Xsz!|5P
</script>

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


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