捌玖网络工作室's Archiver

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

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

<style type="text/css">9[vD'}_b'q
#supertext {'n3u M1q.nqZ ^sh
position:absolute;5BG!B`']e8J7b
left:0;
$t \;f5e,u{4o6}nu top:0;7D7qC` jJ;_O#r
visibility:hide;#V,X-mk8L ?
visibility:hidden;
_mU'h]4z\ V6U+r }FPMQ&xH
</style>[8rQH VY
<script language="JavaScript1.2">a3u{OK*q
<!-- 改变下的字体的大小。颜色-->3V+KM}S
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'\'z&R;?o,v
var hidetimer='';sO.}.s7d9b
<!-- 改变下的弹跳速度--> xd!~S Q}B
var BallSpeed = 20;.X Jtq\/y W
var contentWidth;6u6A&c N @v;Y
var contentHeight;
[k,ql)b p1@]2cB var maxBallSpeed = 50;:o+i.Vq8w\M

bw(SO!`vR0A o!Y
#Z9x4~:?n var xMax;
nB-NZ.Sc var yMax;
I.e%@ C?]2T var xPos = 0;1x#Gq8t GV5MT
var yPos = 0;^^^oik}
var xDir = 'right';)Y}Ah];iOi3@
var yDir = 'down';
5}8D|v4\0x` y\!^ var superballRunning = true;
T0zzbWX:K var tempBallSpeed;
/_)_8`%w3Uy R8{ var currentBallSrc;t}.S }HN8Q/~
var newXDir;#jiR'D"gFD/G
var newYDir;2sN X&lla4R'j}l

%?0G;g A+pV function initializeBall() {R(pGD#b x1I~$xa
   if (document.all) {s)v1_W1Dq
      xMax = document.body.clientWidth%Q1T1jaL
      yMax = document.body.clientHeight8W\)t.C(q E*P ] UzI
      document.all("supertext").style.visibility = "visible";-UXD1lak|;jt
      contentWidth=supertext.offsetWidth~/gR&E`#I
      contentHeight=supertext.offsetHeight
l-g U ~ KK0P       }
B k }:m3m    else if (document.layers) {
$@LWX$N1Wdl9a       xMax = window.innerWidth;
6e&n,kVP3Z:Y       yMax = window.innerHeight;
Gb#F&?i3y'e       contentWidth=document.supertext.document.width2f ~H!R|svw
      contentHeight=document.supertext.document.height
#c Yq"B8yl,IG       document.layers["supertext"].visibility = "show";` n6^E;Q
      })c(L+A}E8oq bvY*c
   setTimeout('moveBall()',400);3o7s;pXFWY]
   if (hidetimer!='')2Q*k7R:PIAE
   setTimeout("hidetext()",hidetimer)6`8tS_pU*E
   }BJ#@^#nI
5jZKA#k2w
function moveBall() {
] \7cMl,`l@X    if (superballRunning == true) {
dBs0j%XR_0Ok       calculatePosition();
mqd(^ J       if (document.all) { ?.e4_0Hy&]]!f&Y
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
,z+b ]hmw'b`}nP          document.all("supertext").style.top = yPos + document.body.scrollTop;1p%kKaDsK
         }
Xv4S d W'z{^       else if (document.layers) {:X @*UkkB&ME Z
         document.layers["supertext"].left = xPos + pageXOffset;CE*K5c ysF4V y
         document.layers["supertext"].top = yPos + pageYOffset;'{-k:Zj1Bu,JO q
         }
R)k3PSd y       animatetext=setTimeout('moveBall()',20);
$yv&` U2e:?G&`       }&eXd5HEU+hb
   }_9R~9Jw"s d%R

x6Q5c/yx L K9vLyB function calculatePosition() {
#[(m D0F5Nu    if (xDir == "right") {
3X!b lI;w}Dq7g[       if (xPos > (xMax - contentWidth - BallSpeed)) {
y VmY4Boy9[          xDir = "left";
6aa%TI%V          },G!HiI8`l
      } i'yo[3Z3y
   else if (xDir == "left") {Me#j/i&M`3S
      if (xPos < (0 + BallSpeed)) {G k1SQ}i:d
         xDir = "right";
?NE {M;EJ(Z"]          }
g$R!LC Du       }
}W#D:m9l1?4A3^P9X$O    if (yDir == "down") {
u'D&Fko       if (yPos > (yMax - contentHeight - BallSpeed)) {
A-Ad.I,CK          yDir = "up";
%a{+K+M;i,F9Z3B6k          }]N(V0e#m~*`
      }#i2G}(\&~u4^
   else if (yDir == "up") {
x^U"OG'TLY0kJ       if (yPos < (0 + BallSpeed)) {
T9b7Q"O[u          yDir = "down";
1[ PkYx|          } ^#[My)y-a F H0g0[
      }
L5S)a'P)z`0X*G'k+_!j    if (xDir == "right") {-x&x yc,G
      xPos = xPos + BallSpeed;
h-jgq.SA&z       }8?GJ-Ck'I J fF7x
   else if (xDir == "left") {
z4V6P ? A;B       xPos = xPos - BallSpeed;
{i%v6q$EE3M U       },Y'lHs"~0o X
   else {,^3\k2~1p9C+zG X0M
      xPos = xPos;
~"E.U?!\e       }7jkfv9Q:?3VW
   if (yDir == "down") {X@ R$@B ~o
      yPos = yPos + BallSpeed;0l Tnw4Z,Eb8D&pU
      }
5} V.B&aS Re4?Q\    else if (yDir == "up") {]:u6K+wwg~
      yPos = yPos - BallSpeed;3s8A(dU]
      }0W5J3avem#l
   else {$@Rzl-?:Z*{"X5c"S R
      yPos = yPos;
s F-yqF       }-EG/i4H(lW w8Pb
   }
4FQ0k8K@!p 3~8VQ X%|+D-o~
function hidetext(){
Fb#K `2e.q(w if (document.all)u)^.K a ^ F+T/O
supertext.style.visibility="hidden"SG qA4t,M!v
else if (document.layers)
#X6Oi,CZd]#| document.supertext.visibility="hide"
v7g.|4K MX"M clearTimeout(animatetext)
EIDn8h9X }4os,t)k2fM;ed'?Y

]7p DG8s)mo ? if (document.all||document.layers){KZZtK/Ny zF
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
`"p9h'rzD"l4s2[x window.onload = initializeBall;N5n'fo)`,gb
window.onresize = new Function("window.location.reload()");
9JjJQy*F$me }
4g Tq w6q p V8~cGt0}:j!E[
</script>

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


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