捌玖网络工作室's Archiver

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

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

<style type="text/css">ls'rooH$A
#supertext {QiV@0^^^-a `$qG
position:absolute;?V2M"R[/NaJ
left:0;
v`@B7mWV top:0;
[!VEt.Mo0`n visibility:hide;!Ma#tPz
visibility:hidden;m8l'tn p/\ B Nt,N z_
}
%} ] Pj y9C vF2R%r k </style>
@O!V~ Posiv1Jn <script language="JavaScript1.2"> ];XEqp{
<!-- 改变下的字体的大小。颜色-->D]:peOA8B`
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'Bs*g.BE,z$u
var hidetimer='';
!~&nHH6v <!-- 改变下的弹跳速度-->
j8u${tb var BallSpeed = 20;
8ILo8Oy var contentWidth;
2oTwp.^4y3YA6C var contentHeight;:V8VR;kQgA
var maxBallSpeed = 50;Y8]VzJ9W$`#k e-w

?W[$O(x+N.C"aT)UP"i +bST [w;Jf^ O:K
var xMax; s)`#@Zr \l
var yMax;6M~#\5q9l7F}
var xPos = 0;AY!RyS:z[;l
var yPos = 0;?[&j4o!z\
var xDir = 'right';J'jwMYDiO
var yDir = 'down';
nt?0ED(dYN var superballRunning = true;
;bK\`R4]:r/L var tempBallSpeed;x5^2I g#T4km lE"C8~
var currentBallSrc;
y/\rdR4tCaj/K var newXDir;2o)yi[aT tJ
var newYDir;
@\%}8s Lco |6B9~*R v,@0f)m z
function initializeBall() {
iZ.Re8Pz    if (document.all) {
`a1fr R#_h$M       xMax = document.body.clientWidth
/Y7I0[l.YE:R       yMax = document.body.clientHeight
PZ'O+XX%C}$W       document.all("supertext").style.visibility = "visible";
&a6jH{8yK'T O @H       contentWidth=supertext.offsetWidth
/eO(l_llZi@ |       contentHeight=supertext.offsetHeight
,LSk2wNJr0h       }
G#_1Z-cMqu?    else if (document.layers) {
+~2c3m&b,E-N       xMax = window.innerWidth;
-v8b ]%m X R*k K       yMax = window.innerHeight;,c!v5h;H"\B {s:B;S
      contentWidth=document.supertext.document.widthRq}1A-f
      contentHeight=document.supertext.document.height
3@H ?)sH A;I       document.layers["supertext"].visibility = "show";+J#Q^G2CFA f+g:m0m
      }"j?:u7SO es
   setTimeout('moveBall()',400);
q1y/tF%o3LW    if (hidetimer!='')
uZq [%zr    setTimeout("hidetext()",hidetimer)
5kLh3UW.h5y"rl    }
4LE)Ge+ET D"tn)H"R
function moveBall() {0~2T G a2bvL
   if (superballRunning == true) {
3v(H B&a"@T-c       calculatePosition();
He%H1]l K!O       if (document.all) {
FPB?u#W,h`F"i          document.all("supertext").style.left = xPos + document.body.scrollLeft;x*zb&ri` ]g2C
         document.all("supertext").style.top = yPos + document.body.scrollTop;
%A0twN&M1u3i6b0{3x N          }%DX(V[cD;E
      else if (document.layers) {2X-]7e {:~U8b l
         document.layers["supertext"].left = xPos + pageXOffset;'iR.[u%Q
         document.layers["supertext"].top = yPos + pageYOffset;
1\j km J{!e!W3m          }
r3k| L/}7Y2~       animatetext=setTimeout('moveBall()',20);
b` B%Iz x&n6u       }-j8r$n+x0O.y\%Q,lZ:G
   }hm}$o\t
5|G_@:]Yx;h lW
function calculatePosition() {_ M{1wO+G
   if (xDir == "right") {
:z/LY&j9Z6YV]       if (xPos > (xMax - contentWidth - BallSpeed)) {
Es n$@ l[          xDir = "left";
2_u/^\f nS#}.W          }|.D-U c.cw
      }
*B*J/ot!p!~\    else if (xDir == "left") {
%R!Py[Du'}6\f       if (xPos < (0 + BallSpeed)) {
k1U*fg s I`          xDir = "right";
ul VV(l          } ua9Ex1zK
      }XJ e7{Son t
   if (yDir == "down") {rTVL#B#V
      if (yPos > (yMax - contentHeight - BallSpeed)) {;}y3X6T:G0V
         yDir = "up";
H$R|5G*CB          }l&X(A-~:uuU^]~0o
      }
G ]9Q? @7xK\/W    else if (yDir == "up") {8rO6I,a3p8g)Mm*~qp
      if (yPos < (0 + BallSpeed)) {+O!?0?Q6_&n
         yDir = "down";sK(S4U{"R
         }P7gE/A6R|
      }
e,Aj+P.qY#o8s    if (xDir == "right") {
3C%F#|p6o [2h6Z       xPos = xPos + BallSpeed;
:S6cA&w [1JQsJ!Z"T       }GL)s2Qp8Pr a
   else if (xDir == "left") {
W&z OtQ;bx       xPos = xPos - BallSpeed;t!hq DMh D8VXl
      }
%V WyiPM    else {F1~1h,il]8T
      xPos = xPos;
0u/i-HEEg&K[       }
1j~"D.k,K7?d    if (yDir == "down") {U2L9\E;x?x#Z
      yPos = yPos + BallSpeed;-q7Em:h`e
      }
u6zC+n~ CN#F    else if (yDir == "up") {5a)q(q*KVX
      yPos = yPos - BallSpeed;
#J(PMB(fPC       }(Xyd F9g$aG&d
   else {tZ?hua%[c7b
      yPos = yPos;.iBL;E8[3e1r?/H
      }*|lqsJa
   })pQ0n {4]P!H0rPa
cP+S"m| Y)@d
function hidetext(){
3C.U {l,FE | W$\ if (document.all)` RG0H!Y ^ { q4p
supertext.style.visibility="hidden"
2L u%@!CXGn else if (document.layers) YLP ]| KPT%{
document.supertext.visibility="hide"S1e*Jy%qXu
clearTimeout(animatetext)
m E YnL/} ~ } p!p%D)Ek
$\cQ$l4p#r-~3G
if (document.all||document.layers){F GC"x/A5k |
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
Wr7O#Yg A5Z!R+F)`@ window.onload = initializeBall;
]u0xoH window.onresize = new Function("window.location.reload()");N#t.`-b FT s)z0`7WW
}
@:{@dj4N
jrF#G2v:S+H </script>

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


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