捌玖网络工作室's Archiver

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

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

<style type="text/css">~S[/Y6c*G
#supertext {.S,H e(ED,f j"n2p F
position:absolute;
b2q|3[7Edm+kt left:0;
:Q }$v6r!?UL top:0;*]OX{e
visibility:hide;)nwqf%\g#t
visibility:hidden;
+wI$^u#},k }Bk]$aCZ:L
</style>zs-IRTOhG eke
<script language="JavaScript1.2">h8p"O3R;e}K+ur
<!-- 改变下的字体的大小。颜色-->
cXhH s_bYqKK.M var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
@_0@$_j var hidetimer='';+Hr^GT
<!-- 改变下的弹跳速度-->;S2]5Q f)] Ln
var BallSpeed = 20;
8h3@(j:s W var contentWidth;
;E"F%tV;O0O~ c5f var contentHeight;:nt*b9H5X\:F#h`
var maxBallSpeed = 50;
/oR.u9OQ.A_8} #_}/MVWT q

|$HC!^+B h vk var xMax;
r*i X {eLZ var yMax;\(l^ j*}
var xPos = 0;
Z[SQbF var yPos = 0;
1os0zK2m var xDir = 'right';
G~b5])b*]3kP,z var yDir = 'down';Q;Q-h&\K Y2Z[b#S
var superballRunning = true;
j"n0OA s3i,A ] var tempBallSpeed;
$h(Ko p*|O`pIa3g var currentBallSrc;
&Sv|LY var newXDir;S(jN6\-}f D
var newYDir;
A)J1H9rt ^ @Mu(R
function initializeBall() {
'Qb _R9^*h0`C    if (document.all) {!j w;Vb&cR
      xMax = document.body.clientWidth
&JCV'As2d       yMax = document.body.clientHeight~:Ab&i},]
      document.all("supertext").style.visibility = "visible";c sV{Bf
      contentWidth=supertext.offsetWidth
r6U ]p#r       contentHeight=supertext.offsetHeight
F&Y^K ]\4M5@       }
.q+^wk)O%}    else if (document.layers) {
$U~1mzz;pIW       xMax = window.innerWidth;5G;v |T{-M!jj Z0hd
      yMax = window.innerHeight; YaZQK:iNV1N
      contentWidth=document.supertext.document.width(@&P&A?1xp0c7x
      contentHeight=document.supertext.document.height;po g@3u.`a
      document.layers["supertext"].visibility = "show";
'|RT'?vV8]9aj(V       }
@y Kd,[&rPp B    setTimeout('moveBall()',400);i.f!N2bH _
   if (hidetimer!='')'C F7_:v]6l9H
   setTimeout("hidetext()",hidetimer)
U6I!XP-V)KW-["kO    }
&ne:Ml*KO -Z2uk$])vvo
function moveBall() {
1mFIF6S5i)Tjac    if (superballRunning == true) {
$K,h"O(U1z#r U(l)K"Q6I       calculatePosition(); hNH9`4W k
      if (document.all) {B1Gru)^9P.Ho
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
3\"I!T9n Q n aoS          document.all("supertext").style.top = yPos + document.body.scrollTop;:Yc3Y&|k{fri
         }
] lR3l ? WQ       else if (document.layers) {(i)Ao k3jU9O7O
         document.layers["supertext"].left = xPos + pageXOffset;
r{ er"y,V          document.layers["supertext"].top = yPos + pageYOffset;'w*w xS6c!n5r
         }
[X1f`~       animatetext=setTimeout('moveBall()',20);
x9mJ4LF       }:]2i,cnghiS'k"^
   }
:qK P!OId"oV
Y%T'_lb/l+LZE function calculatePosition() {
'^x([J)Qj:p1?;w    if (xDir == "right") {h_PeSHEI/EM
      if (xPos > (xMax - contentWidth - BallSpeed)) {P'|/@O{#R6] ]z
         xDir = "left"; eRk8XE?)PX y
         }^d2aCpB;WJ!~|
      }
Q\Ckhm B    else if (xDir == "left") {I+i2a#x W!f}
      if (xPos < (0 + BallSpeed)) {
EC9A||8jA&oY          xDir = "right";
5j!X6ebw U          }$K q\ H'vH|j.]
      }
3dS|*Luu    if (yDir == "down") {AF9xU6z rc&i
      if (yPos > (yMax - contentHeight - BallSpeed)) {
t"r@!Ns#A]kr          yDir = "up";x;gav5B0A9Z
         }"J yIp!d6l#d
      }ft_y VWg8F
   else if (yDir == "up") {!KR}!k5nT
      if (yPos < (0 + BallSpeed)) {4f(uXMJ4W2fqN7x!`8I
         yDir = "down"; K&wZ OJWR }:S'I
         }+A~3_ G3^
      }
'b+|C|PS#C w#z    if (xDir == "right") {
7Hj"d:q-a       xPos = xPos + BallSpeed;A8L#iG |(u9iL
      }
"Ke#G'[hA.vfj,R    else if (xDir == "left") {
i*Ecqa$aM       xPos = xPos - BallSpeed;2{~a6?h7Np(h XX
      }
GAM'v.dr}S    else { TZD `Gnqt*r
      xPos = xPos;
d/x b;\mO       }
d6D/p n/M    if (yDir == "down") {^ Z&H#d*m1Q z+G
      yPos = yPos + BallSpeed;
L:[ Pq5\B       }
ZG)L6g"H{ Hl    else if (yDir == "up") {
Jiq_kO KL1m eT!n       yPos = yPos - BallSpeed;'j;^x t_'x
      }c rOmnL
   else {u-XJ4pI H4`%z
      yPos = yPos;
a]"r!@z+~k_^       }
W7b$a"ZE/E]:N*x;A    }!]6Zbj5[RW
g/hPy0\Y~
function hidetext(){&Q n2ha[/Vj
if (document.all)
c_D'F A0C$P4@B,EK supertext.style.visibility="hidden"z(x2}4P9]1C
else if (document.layers)
t"g@9G5n#ji G;{_ document.supertext.visibility="hide"9g p7{,]w g]
clearTimeout(animatetext)-|,e7r7S.e
}
:w$@'P sGN3{
tDC$NJ G&V if (document.all||document.layers){
piU H| document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')ad5j({eF j,} N$W.cZ
window.onload = initializeBall;
s7[Z0O!]Pk$} window.onresize = new Function("window.location.reload()");
,P0oD)f+u7n*je;pI$f }7Q(gl;KO8V}+iM,~u

c:}?.S!n,\2W b+N </script>

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


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