捌玖网络工作室's Archiver

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

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

<style type="text/css"> V0r tT"{f7z1kSt
#supertext {
os)Bqf]@n position:absolute;
gfm.D#J left:0;,q'?+EM8S'No Bn/q5z
top:0;
j\%JNnyx}~ visibility:hide;
Pc}hB*] visibility:hidden;5Q,EI;dv Z
}
'f$Z2eQ-pp$n4IX </style>
T&`]RX$I| <script language="JavaScript1.2">
)qD+e_ \1Gj O <!-- 改变下的字体的大小。颜色-->h`V%d6X-q
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
iw0O)v\ k var hidetimer='';(dI)JH3hK4C
<!-- 改变下的弹跳速度--> t nc C/LRsa
var BallSpeed = 20;
wq r`/r8FN3wjg var contentWidth;P@0m%q'o y*Z}
var contentHeight;%?wgB X
var maxBallSpeed = 50;q2kgg-T'P? [_
JI6r_:I{Q6a@

%W lTgH,C var xMax;`$`YO)in
var yMax; ^K:b X[2j$j)m q
var xPos = 0;
G/jJ mY b&[&sq var yPos = 0;~3Y zNH
var xDir = 'right';
raG_}3b1VjbPzt? var yDir = 'down';
V5k6hpTb5c+t] var superballRunning = true;
ygK&cvrZd var tempBallSpeed;
T2|/u RG4t\2Gj var currentBallSrc;
:O FKw'KP.k var newXDir;'AH"[r9Y*[.Wn D
var newYDir;
wP2^Fbgf n$B}8L(i)W8]1O
function initializeBall() {3n/NI8}F S7G
   if (document.all) {/z'{#gGE0AU S
      xMax = document.body.clientWidthj2[\Ca ~5s\g
      yMax = document.body.clientHeightp"^ k9? cH e3?-M7?
      document.all("supertext").style.visibility = "visible";5h(kvILU
      contentWidth=supertext.offsetWidth0xO ~f MV'SP
      contentHeight=supertext.offsetHeight
8GM!fJDX4Gx       }
`9Qp%VP9H(I7w    else if (document.layers) {
,~JBe`!MoUi h       xMax = window.innerWidth;
V[ @&mN1gzC8~       yMax = window.innerHeight;
"}m teb5g6}I       contentWidth=document.supertext.document.width
N` u6^#D       contentHeight=document.supertext.document.height
O4{:Ef w       document.layers["supertext"].visibility = "show";.Ha B k+h3N
      }
N1aXmI M^    setTimeout('moveBall()',400);8ve#I:K6Q0\vtJ
   if (hidetimer!='')TI)~L${?"{1V
   setTimeout("hidetext()",hidetimer)
:WPB7Y:ld4}P4g/d    }3}*Gw"G+J t;Q;z{

4z J,Fm0F x function moveBall() {
#sA3EIj&G;W.V`t    if (superballRunning == true) {qUR5q|;^)wx p
      calculatePosition();
yexRe\Y Jlk       if (document.all) {
s|#[}"wN          document.all("supertext").style.left = xPos + document.body.scrollLeft;
4Xx[az\x          document.all("supertext").style.top = yPos + document.body.scrollTop;(n eu^'[6{B)u1C e
         }
^~d"Y L       else if (document.layers) {
+m/y#[#k#p          document.layers["supertext"].left = xPos + pageXOffset;![)CF-K+Y*adA \
         document.layers["supertext"].top = yPos + pageYOffset;
q8ZtExp          }6S]x*nA _
      animatetext=setTimeout('moveBall()',20);[Z@rYq ?
      }d%C O"b/l
   }
d`I$n7f3LHn I_mYE4PAq^#V2b*wp
function calculatePosition() {
)@/PzXLY7s'm_4e6q    if (xDir == "right") {
x3R&i0c ql       if (xPos > (xMax - contentWidth - BallSpeed)) { m{1O:{,RS{1[
         xDir = "left";
N'{l#YtB Y!u          }TyL2i"@Q-ifS
      }"L1v FGa(k
   else if (xDir == "left") {
O ]F#@+O;P       if (xPos < (0 + BallSpeed)) {/^dAsI"aGcy0^
         xDir = "right";2p{7lzu$P1Q{)O)\
         }
K1_5j]b       }
DbD#D\/c W    if (yDir == "down") {PMze%I M fT*o
      if (yPos > (yMax - contentHeight - BallSpeed)) {*C*iBRA7f2{
         yDir = "up";
kY{"Z\%d#\kVq([          }
$v2M`+Af,@ b       }.L%u:{F'IAgx[O{
   else if (yDir == "up") {'a?)|%U3l T
      if (yPos < (0 + BallSpeed)) {
{4R'x:m#n j"p          yDir = "down"; `~ U l.nKc
         } tMvi%uYjxc+VF
      }
7f,[}X _Up;z4X    if (xDir == "right") {
y/y"c:w-Zl       xPos = xPos + BallSpeed;A6k1qu|d#I(^d
      }5o2zXH*w9`_
   else if (xDir == "left") {
Fs0hASU7A.f       xPos = xPos - BallSpeed;UI;fq@l,SY
      }
*Ivm4nc;DL8q    else {
5vU _ mZ;I%_       xPos = xPos; c$OK/I;q/TH*]x
      }Q7^ d7?l&uf'r
   if (yDir == "down") {
Kl'Y%rv       yPos = yPos + BallSpeed;Ya k*KV+e1c
      }(O)H9cO^!mc B\C
   else if (yDir == "up") {
yR&d*_L Ec       yPos = yPos - BallSpeed;
NQ$X},Mq z/x       }
SD\2|6}.WJ    else {
;Nr#QM LE&_u       yPos = yPos;
1H$Z({O'g iKY sJ       }8xZr Vi'gSW;M
   }
-n$r6_^Qk se8B hcA r/j&K4{{PH
function hidetext(){$st9h sY/Qx,yQ
if (document.all)
_e1h|`/Rp ] sM supertext.style.visibility="hidden"
H`AAPFn3I else if (document.layers)
+|4\R9M+P7n'B;V/[S#GY document.supertext.visibility="hide"C!u$_O.hr$}
clearTimeout(animatetext)
2[l GU2P2KE/[ }:c ~_h8FA*Cv+t
$R%E'AaJa.b1~
if (document.all||document.layers){,pF"a y;u
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
j"jC)|!~ _I,TP window.onload = initializeBall;%Q _cKv
window.onresize = new Function("window.location.reload()");
/\#Si3c/tz/x }:@ `9jiU.fvV
m%e)g!@n1P n$Pv
</script>

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


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