网页之不断弹射的文字-特效
<style type="text/css">#supertext {S(qV |$XEf"xsdz
position:absolute;
left:0;
top:0;ub?C+^&_$U#b
visibility:hide;X~S1S nLb/vYt
visibility:hidden;
}
</style>z2[7RS{up!M9E`
<script language="JavaScript1.2">9OJPV \jAH3pG
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'gZ9AA/E~S ^
var hidetimer='';8mZS]q#Z2e
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;o&W8Nx?pP
var contentWidth;
var contentHeight;/S&b'[Lg@O;H r
var maxBallSpeed = 50;
*HY x;l#F'W+t8~
var xMax;
var yMax;
var xPos = 0;)@;B:^0F+DC
var yPos = 0; N_/{2R:ZQ
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;){~z5m;O*FY"WR
var newYDir;
function initializeBall() {k;sY2QoW;J
if (document.all) {@7QN1wSL
xMax = document.body.clientWidth+Y3K&k6Z%a%H
yMax = document.body.clientHeighteO(I,m8wI,z W]J
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidthc IJ'o2b]&GG
contentHeight=supertext.offsetHeight
}8q+qu]n6z w&_l
else if (document.layers) { t&f5Ay_Re#W
xMax = window.innerWidth;
yMax = window.innerHeight; Bd1Y*M4iN(t a(Jt
contentWidth=document.supertext.document.width(|4~'H7W&@,h
contentHeight=document.supertext.document.height(Y C \3V4q6}J
document.layers["supertext"].visibility = "show";
}n5FN3pTJF
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}a]J;m`5IU
function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;W-|Nb:T/f&}4az MV"W B
document.layers["supertext"].top = yPos + pageYOffset;
}
animatetext=setTimeout('moveBall()',20);
}
}$R$PN3q*]
function calculatePosition() { ?3bk ?'V(|-|
if (xDir == "right") {G2AO~;o IJ
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";L:PpR#D5z9`
}
}U g@U5n&fObF'M MDV
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";bYT2pRXS*Zd
}pM[ dRSN
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
} z.[+Dg p}i/c-r@
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";
}
}
if (xDir == "right") {
xPos = xPos + BallSpeed;
}{T4`nB%bV
else if (xDir == "left") {
xPos = xPos - BallSpeed;'\R[/Gg
}
else {-Z5j w6uwcc
xPos = xPos;8KC%K0q"W
}iq(t0j2jP cP9B
if (yDir == "down") {U_5Ff%y)Q \ m
yPos = yPos + BallSpeed;
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;
} j1sYQM)Kc
else {
yPos = yPos;\bEDh:qjo
}
}.b4kZ"v"uZY
function hidetext(){C Sa7g u~ _Bm
if (document.all)
supertext.style.visibility="hidden"(K Vl;m]*TTY
else if (document.layers)x,l a4na!yn7b"X1t(_
document.supertext.visibility="hide"
clearTimeout(animatetext)i:E"S M6U^(~5i0e
}
%|&i$N On
if (document.all||document.layers){i8n{O/y~%dqO G
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;