捌玖网络工作室's Archiver

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

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

<style type="text/css">
RVt$n*txP'Y #supertext {8\#uF1t"gg
position:absolute;J,]|t;\/t
left:0;
6]w6V oY&o top:0;
_ e lb~|*r2?6Kj visibility:hide;3\t$aX7I6pd5o
visibility:hidden; G:gpZ.J b
}0f'O#tb5e_
</style>
:j+D3JR-]7D({+p <script language="JavaScript1.2">
r{6l`+S4G <!-- 改变下的字体的大小。颜色-->%Rt%ip)P
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
,MYT%b W%R var hidetimer='';!}/B O \ @IE'z({g
<!-- 改变下的弹跳速度-->
y6Vw M&eo(s var BallSpeed = 20;
6q)Nzf$xD(C var contentWidth;
#GH*X+oPw var contentHeight;S:\`2{1m"RD(h
var maxBallSpeed = 50;
'B Z8U3tS:E3^9o 1]A|'bc_B
&x)F&x%v?/{\4Fa'W(` g
var xMax;
.S8l;UCZ var yMax;
e;g hf_8h_7Xs var xPos = 0;/R P0Dof*M
var yPos = 0;9Y Z8\s(B
var xDir = 'right';
9O}6@`N(nVQA:yi var yDir = 'down';'dY@]4rz6}`
var superballRunning = true;
nwP9tD6g8k var tempBallSpeed;
A L:w3s5qUV var currentBallSrc;i j/uz9RBt
var newXDir;t-r%?+bs[C*F;G!G
var newYDir;TZh$k*UqKr

_rU9])`3Su function initializeBall() {
S'x7F oj_    if (document.all) {
/s:{v1\*?.`,o x       xMax = document.body.clientWidth
R)@t5L:Vg,lq)t       yMax = document.body.clientHeight ^,a+@$S4m:mR3uK
      document.all("supertext").style.visibility = "visible";:x:]CG1eg9O |K
      contentWidth=supertext.offsetWidthl \2cy+_1DkG/e s
      contentHeight=supertext.offsetHeight
j hjQ'H)_       }
I;ii&eARzWQ    else if (document.layers) {
8yibb$d%F&`^       xMax = window.innerWidth;MKe[A+y%^bB
      yMax = window.innerHeight;
)YB4s`Y       contentWidth=document.supertext.document.width pFwE)R:h-Y
      contentHeight=document.supertext.document.height
;B$Z/?*O-X$uq       document.layers["supertext"].visibility = "show";4]X? P4FB
      } V9VTF%A:B
   setTimeout('moveBall()',400);$V[1o `*| C5f:q
   if (hidetimer!='')
8noSOx\    setTimeout("hidetext()",hidetimer)
Bb _&F ? R@&Vg    }
K~4yv&f0? *}TB[CqS
function moveBall() {Ap1i/nJ(Od
   if (superballRunning == true) {x F6|:ZS J b
      calculatePosition();
,tyuT&o rM       if (document.all) {
M5nZ'u~ujQ          document.all("supertext").style.left = xPos + document.body.scrollLeft; ll0hTk#sM8e
         document.all("supertext").style.top = yPos + document.body.scrollTop;UENMtD/A
         }
3mm3wS D$Q4`(I(x:x8oQ       else if (document.layers) { q]DFob
         document.layers["supertext"].left = xPos + pageXOffset;
_.T8ex [          document.layers["supertext"].top = yPos + pageYOffset;
1eu'A~H`py([          }^\Bw"n
      animatetext=setTimeout('moveBall()',20);+d8i.B4?MQp
      }
1o_)_'z:_3z4tl'h Z    }
v'k-BO5av"f [+H7G,v%Yv(P
function calculatePosition() {
g0bm9rW0SD_    if (xDir == "right") {
+Yh4Lx%KD!OK       if (xPos > (xMax - contentWidth - BallSpeed)) {
o2| e1i"e8wu7EG          xDir = "left"; C}+fc!i-U
         }
b|-n'L9n#@       }
+Rb&l`V8@)L    else if (xDir == "left") {
pV)} c^:N/F9s       if (xPos < (0 + BallSpeed)) {'hJ h+m @
         xDir = "right";
G6cV sY*`"k#M-Uc          }
{+a-f1lc6q:`})c t       };B k@2C:L \6^
   if (yDir == "down") {
f-sE0@q$IH9o6m ]       if (yPos > (yMax - contentHeight - BallSpeed)) {
H$R$DIj          yDir = "up";
"r#WT1{jn          }
C?O0[/]%z,R       }
wVEoj RQW    else if (yDir == "up") {MvH.@#h{dE
      if (yPos < (0 + BallSpeed)) {
)|#pkj&?|ab"KL t          yDir = "down";f v1p#@%G:?1h
         }-A(DZ/lUek;Fd!z
      }
)U TPF)J3F0N @k    if (xDir == "right") {
#iT:vX/Zk       xPos = xPos + BallSpeed;
es\,B/@N7g P       }
(@)a0Kd%q*^_Vw    else if (xDir == "left") {KL8S%F&M H
      xPos = xPos - BallSpeed;
4J9Hb}m(Cr%f       }#NsVa$V]"Z {&[(Z
   else {:d/PK7a G:D+iEr
      xPos = xPos;
d3Jy[T&N S       }L\ A:] \ _/Wi
   if (yDir == "down") {
?.Q W0W YW(}{R{+S       yPos = yPos + BallSpeed;
0ZkO*V f9apj2}       }
8A0aW.a7]/w    else if (yDir == "up") {|:B"Z;R"EC u \
      yPos = yPos - BallSpeed;
'p d?K"b       }tW iVf gF-fV
   else { FX(Gz"s4P m
      yPos = yPos;
e5Y }"g9q9n Dk       } vk3FK{
   }
}5s,qS _"a*N*U T3j6]!pZ7OH w2r
function hidetext(){F+E5d1T?G%ds[
if (document.all)Ohjo4re
supertext.style.visibility="hidden"O-{9y#R9T7L8C
else if (document.layers)
A7]y"m R H document.supertext.visibility="hide"s/t^:{*U;I
clearTimeout(animatetext)
I xT+}F[b2j;t/k'c { }
`-w.s9}Y-j&{ G4a@&~~C4L#?+`4Q#z
if (document.all||document.layers){!TX-VYnS*]
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')7kXKmRW/E)P.B
window.onload = initializeBall;T ] r5H s f4S-q
window.onresize = new Function("window.location.reload()");
5_NC|"p[-q I }
1~%aJ)sd;{+h9hF :A#{BS4G$D
</script>

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


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