捌玖网络工作室's Archiver

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

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

<style type="text/css">
/T*ESsb #supertext {
;r8~ R/v0_Y/Gt position:absolute;(t8F[ }g `4V3O8OE1Z-K
left:0;$ax1`3FarQ
top:0;
Xc~+pjw1t@ visibility:hide;~!~F4]5^ XG)m}4M9|{
visibility:hidden;Vk4Tg LxP z
}
2KR&}|/od-_9cw </style>8ZC,_6@@/j O7o
<script language="JavaScript1.2">
J ]\"B\'a5i k <!-- 改变下的字体的大小。颜色--> F"X6vf:R
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
ZTJ e6A| | var hidetimer='';
rc:Y+ifA!_x <!-- 改变下的弹跳速度-->w&S"O"Q:L2g+CT8\
var BallSpeed = 20;_s8}S+lT
var contentWidth;
hK q)s:d var contentHeight;
n l u$sg|+j.r QP var maxBallSpeed = 50;
/{HCB&[ #|in3Z/o.O
Fq+cv`0\@0nP*_-C
var xMax;
L9|B/s+{.D var yMax;
?ow`NQH var xPos = 0;&U$r'\4{ X6v
var yPos = 0;E5~U}A!i
var xDir = 'right';
*B"ji [5L!oF&Y var yDir = 'down';
t)v+E5Dh| var superballRunning = true;
k,e Y_"f1s.p var tempBallSpeed;
[ G7p+J9gh var currentBallSrc;+m:ZZ"q(i} Y'G6^
var newXDir;
U.?)d(R m%U W:x5B var newYDir;
o P;RN{5UG\
0Y/r;HNM function initializeBall() {
t,Kum8?c+Q7d    if (document.all) {d%U;l;VR#Sn
      xMax = document.body.clientWidth4hJ5y8R&jm
      yMax = document.body.clientHeight
5A En.{N,L_1[       document.all("supertext").style.visibility = "visible";
S-W]e Zw       contentWidth=supertext.offsetWidthU&Iv2x.WS%[,D
      contentHeight=supertext.offsetHeight
j-k6m/k^;F lo0p&?"@       }
)WyL.z;xR1w T!I    else if (document.layers) {
[k(V3`h$^6C8uCz       xMax = window.innerWidth;ViN+z%m&T(Ix@[
      yMax = window.innerHeight;
4x `l4M_&e?!o       contentWidth=document.supertext.document.widthW1O9c;K G)^8gA_
      contentHeight=document.supertext.document.height l/W `s%F
      document.layers["supertext"].visibility = "show";
-T3I"uGBt*n2~2|       }
VD-AvgUn6?u,@ ](H    setTimeout('moveBall()',400);
7At uZM/z4Kk(}    if (hidetimer!='')S^HX{.{5{1aM
   setTimeout("hidetext()",hidetimer)eU6b jC
   }
1K6Oi8Pa)R,A;vb }q7A
b7Y] Xv function moveBall() {
NEAzA Ej\G    if (superballRunning == true) {x iY~ t|x+M
      calculatePosition();O@ Z2G2BM
      if (document.all) {,l(t XJam
         document.all("supertext").style.left = xPos + document.body.scrollLeft;%]Sb9v0h5_&qHB0S
         document.all("supertext").style.top = yPos + document.body.scrollTop;
vN CG2L t          }$g#^.IHp$n;s
      else if (document.layers) {DB%tv+ndGeP
         document.layers["supertext"].left = xPos + pageXOffset;D dJ"_$ejHItA
         document.layers["supertext"].top = yPos + pageYOffset;
)J/A9\ b!]J          }
X6i.M#iC6tp&p%_       animatetext=setTimeout('moveBall()',20);!IYl N umc
      }$qxL v!KZs `C
   }
2D6u Th'h*fD7?J5p4H3m A5\)YE QGB#I
function calculatePosition() {
^%t)I8sENv v#w    if (xDir == "right") {
,a@9QX N do       if (xPos > (xMax - contentWidth - BallSpeed)) {
kq;VIV;V%e.m6{          xDir = "left";
,jMg7h"ZfU          }9B8t[hg*N/L(R
      }jB6CQc6cn(b1A0Q
   else if (xDir == "left") {
9EK~/J|Lbc/X F       if (xPos < (0 + BallSpeed)) {
I$_ h6^3C#[@          xDir = "right";5nV3m I;s A
         }
@9{)l wZ5XdqB       }+H_TEAlH
   if (yDir == "down") {Q_8bNf,y&t
      if (yPos > (yMax - contentHeight - BallSpeed)) {
&OR,{8WZt          yDir = "up";
$F]L:UZ7Q'KJ2I\6N          }/{y6y*c,BBr
      }
Z$J kcC    else if (yDir == "up") {t EYBK GC
      if (yPos < (0 + BallSpeed)) {
2YU3_8h6vf          yDir = "down";!b hi/w5y2{;hO&C
         }4L!J Vn_y4a ]n
      }
(qDXx P Ca    if (xDir == "right") {/{(g,bw-J.{
      xPos = xPos + BallSpeed;-q{L0KL^ K)U
      }r.tdXQN,A~#L![
   else if (xDir == "left") {&w#W ?Z/b!m^pl(j2t
      xPos = xPos - BallSpeed;(|I6}*iRU
      }C/f u*Sn
   else {
0c]0u/agJ`:t       xPos = xPos;s[x$X0h9]
      }g(|P5OX+~u(QA$mUQ8A
   if (yDir == "down") {2p"fSN!CX T u
      yPos = yPos + BallSpeed;
9R7G5~xsOW%i7K]       }
9U,_O7TP)m+d'\    else if (yDir == "up") {
9ah[g:D#UBS       yPos = yPos - BallSpeed;
9LEh5w|R F       }
7s O4a2`r9h([9`_    else {.m+dd*Sc9KqE4` K
      yPos = yPos;
*J)j.^K*h@H QBd       }
0S8gl dM/M    }T-rERA3}[/|Z
T3ayon"b
function hidetext(){]`!| x{|+?
if (document.all)er7UB:?n*bS
supertext.style.visibility="hidden"
dl3[!`]w else if (document.layers)$]5Ny!|F0IN@
document.supertext.visibility="hide"_/v.h2A.e5_~Cb,YG'c"x
clearTimeout(animatetext)
tV%B!l0uY }
CA5S,UCp+XK$v o&o:KgfE3x
if (document.all||document.layers){
@0Zo%E0B_ B I document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
X U? udU&H)u window.onload = initializeBall;a g:ox/tM6D&V
window.onresize = new Function("window.location.reload()");&X Or"J XD"ul
}
I}})_ V
\ K{3iH| </script>

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


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