网页之不断弹射的文字-特效
<style type="text/css">-@ q'p!Z Q |#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
}-~$L`$rC|tW
</style>
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->5s }*x%kK7H
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'dL.\(H?G{m P
var hidetimer='';f uz8~~VG
<!-- 改变下的弹跳速度-->&K"aeg0y4XVD
var BallSpeed = 20; f FSwSs8H A3t
var contentWidth;
var contentHeight;U t"_4W Mh:E:?C
var maxBallSpeed = 50;)iY%|0M)x&^%g
W#[ GT,uF;Gx ~3| } u
var xMax;rDKJiJ Gru\ D
var yMax;
var xPos = 0;
var yPos = 0;+f0g)O0Kj"H
var xDir = 'right';&_ wbs;p&Y/dwf
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;+Fd9tY"A*P2z7unq+k
var currentBallSrc;7r7K#?-G\Zq:@
var newXDir;3Q0NFdU A
var newYDir;
,zLc!]2[/X9Y
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}+r"Bc8ZBL!Bbp!h1{
else if (document.layers) {%S:s;I{|H1XB:U
xMax = window.innerWidth;3`*biUph"p"_N6H
yMax = window.innerHeight;u6Q.R P&LvX8{u
contentWidth=document.supertext.document.width @I)OL9v)e
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";(yf6D6@"e:tY!tQ
}
setTimeout('moveBall()',400);/JtfI"|uZ$j
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)HK"RyZ.Q
}P1SuX&JB
*YZ o]&U
function moveBall() {-lK9gk`\
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;o'uU,E]E#I:q x2EI
}2e-fh"o-h+w
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;@Yssc ? L$@g
document.layers["supertext"].top = yPos + pageYOffset;)J0E\O1f~*GO6b
}
animatetext=setTimeout('moveBall()',20);f2a#?G ?
}:q7k5oS)Tr5fI f
}
6V~G`\4w8c O8hy b+x
function calculatePosition() {0FwM pi d,G%w
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {g!sb9O&xu
xDir = "left";
} l%~c`(BcB
}
else if (xDir == "left") {6JY"]F!xwW'~
if (xPos < (0 + BallSpeed)) {
xDir = "right"; E6m9at)bY
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}`i0[6E/?*ib;LZyK
else if (yDir == "up") {;t/r u#[%x
if (yPos < (0 + BallSpeed)) {yDsIt6l0H
yDir = "down";&_&R2A6N2@V!Oll(h
} G[VfV.w7O)q
} u"a+DS2\
if (xDir == "right") {
xPos = xPos + BallSpeed;.HmK!Mcg1P
} Hp-h4w*ev[
else if (xDir == "left") {Wk+vG'?I(c~0b
xPos = xPos - BallSpeed;a!k)z'K.q;y$l#P'm
}
else {
xPos = xPos;7mM}D?!~5A
}x&gHg3wWv3N+A2d
if (yDir == "down") {k$UAY*czwu\T
yPos = yPos + BallSpeed;.]|!n5I3cg yf
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;
}
else {n/~^)Ce@
yPos = yPos;
}s4x|Y$o[:X
}G` x4t0@*r5]
function hidetext(){9NB^k%o1w
if (document.all)y.@_TY[
supertext.style.visibility="hidden"
else if (document.layers)5NLuI/vU
document.supertext.visibility="hide"8g l(m-nss
clearTimeout(animatetext)O(~A6o NlC-Pyu
}