网页之不断弹射的文字-特效
<style type="text/css">#supertext {(m1M&di8@e
position:absolute;
left:0;
top:0;U*HH2qg)cx8p
visibility:hide;
visibility:hidden;g:_aZ#X:FjI
}
</style>
<script language="JavaScript1.2">j-@5_){/UB
<!-- 改变下的字体的大小。颜色-->ty}&uP&Gj
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>';S(Iw%AIR
var hidetimer='';
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;7D3mY sw)X5PSq|
var contentWidth;R6A4@1Sc(I{N
var contentHeight;
var maxBallSpeed = 50;gu'Hq,q0u:H(pY"p
3L$LCS(u5n5a$ys a
Sy2N&ht
var xMax;d*@~^Xaw
var yMax;
var xPos = 0;_ aKtRHN%|
var yPos = 0;1F3q'CdseV'b
var xDir = 'right';
var yDir = 'down';h3I p [E o{$_+Z
var superballRunning = true;
var tempBallSpeed;:D%Vqmp.`
var currentBallSrc;
var newXDir;z6a6QW~z
var newYDir;!vHRT a3F!~et
function initializeBall() {2g.f2i-cW1b
if (document.all) {B+S}F0WY#br
xMax = document.body.clientWidth
yMax = document.body.clientHeightDOj,Tj"iT#z#S`p
document.all("supertext").style.visibility = "visible";|#`^ QR]Q3b
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight ?d5Eno6uDw,B
}D(U6E:E!I7`
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight; l5B*ntX.o:Hfb
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}\E!P?7\h&bwG
setTimeout('moveBall()',400);
if (hidetimer!='')2D:c Hp.f7d
setTimeout("hidetext()",hidetimer)
}2KN&F |[W C+J
D_J7T5D2[,lP
function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (document.all) {o+e5q.z}%Q
document.all("supertext").style.left = xPos + document.body.scrollLeft;6D&u;Ny;["`!t
document.all("supertext").style.top = yPos + document.body.scrollTop;
}O3j$z$F6V_I)C
else if (document.layers) {&k-j5{:O7?T
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}Adt,?Ljc
animatetext=setTimeout('moveBall()',20);
}
}7p"o2pc(hb$?P
function calculatePosition() {
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {l _ og6rai
xDir = "left";
}#@ ZOy!q9q&M;A9^
}
else if (xDir == "left") {G[7tx%J/z }!w
if (xPos < (0 + BallSpeed)) {;Y+Vv#?v0FV+f$H
xDir = "right";f9Tv)d$y0W!UG
}
}
if (yDir == "down") {f}n2bK3A9Z
if (yPos > (yMax - contentHeight - BallSpeed)) {J;]:_'hE
yDir = "up";
}
}
else if (yDir == "up") {TyMsY4wiM
if (yPos < (0 + BallSpeed)) {R;n9{~:G/Y
yDir = "down";
}"tvB8N4n'L6Cn~`+y
})nr"N4t?x*[\
if (xDir == "right") {
xPos = xPos + BallSpeed;
}[Q(Q UIr_y5B5G
else if (xDir == "left") {
xPos = xPos - BallSpeed;9RG!lx#u v'zI9ce
}vx-Ss;[9_[4`C.t
else {
xPos = xPos;
}
if (yDir == "down") {&p9u[7Rr ]p8ve
yPos = yPos + BallSpeed;M^I Fs[v2I'k/P
}6Z {'M;h+w
else if (yDir == "up") {
yPos = yPos - BallSpeed;9opCdCt
}