网页之不断弹射的文字-特效
<style type="text/css">d0cg-tqa#supertext {
position:absolute;
left:0;5U S2i t;eEQ#]
top:0;
visibility:hide;8`.J"@`.Ep"H
visibility:hidden;
}-X'K5d,L j
</style>
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->9z_ mdByh
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';
<!-- 改变下的弹跳速度-->6ddi-MK,a y,p5y
var BallSpeed = 20;7Z o6UG"Us
var contentWidth;
var contentHeight;@eY U,n|.F9s%S
var maxBallSpeed = 50;
bwE@.t_"BE
var xMax;X!lD;g$uD9F$^D
var yMax;
var xPos = 0;O-F*L [6y)z*In'P
var yPos = 0;+]&Ed(A3Qg-u.]
var xDir = 'right';%[ L xcsw:C%q
var yDir = 'down';
var superballRunning = true;5HIea4v'}8Ww#AN
var tempBallSpeed;+C/GR/w&LeH{L-L+[.Y
var currentBallSrc;h)Q_&ye
var newXDir;
var newYDir;Q!D5wXa9CwS
function initializeBall() {/GO2u h%D/Q V[ ]
if (document.all) {
xMax = document.body.clientWidth^:VL4b o9M8f@IIn
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight~0U4c a3~z a$nQ?%G)X
}+FLn*S!ak
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.widthH,ng\ @.I
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";$gbu'h ~7j/y"W
}
setTimeout('moveBall()',400);+t7T"o{wnb)o
if (hidetimer!='')$OH*k$M#^%Hg?? jl
setTimeout("hidetext()",hidetimer)pT/awe
}
function moveBall() {
if (superballRunning == true) {
calculatePosition();Y5E"z k[LOQ
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;bi rr@g jK
document.layers["supertext"].top = yPos + pageYOffset;
}1H&e&?9~8oc(~)jVO
animatetext=setTimeout('moveBall()',20);5R/`/HRt
}
}YwXMHt5tU
function calculatePosition() {
if (xDir == "right") {8f%{/c%b$vAJ9Z
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";:]G!FAe i/I V'q
}
}}TccIK%m-M.}#?^
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}BUlx8N]a
if (yDir == "down") {+G#T;T3cO*V*F4h!T
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";Q Tq+e:lVO2bs)w/X3R
}8[0^6LH0X~3F
}Z zo4gvK2I
else if (yDir == "up") {tu1g^d[ tKj'r
if (yPos < (0 + BallSpeed)) {
yDir = "down";Q/~s'R%zP3d
}
})r,lsIohr#ug
if (xDir == "right") { q*orR4T/Q+S0n3x
xPos = xPos + BallSpeed;
}
else if (xDir == "left") {kAS!Xu"t9y1^a'T
xPos = xPos - BallSpeed;q2L^0i0d~.?tMg/Dxh
}
else {
xPos = xPos;
}ULd0xq&zQ-w
if (yDir == "down") {j9a)F Rwv
yPos = yPos + BallSpeed;*[Yc)V6k"N&`
}I$P&Fl'af
else if (yDir == "up") {/Vlh6_,ZO/Y V1UZ
yPos = yPos - BallSpeed;
}
else {'Z [F| `a-`],Q8I;t
yPos = yPos;8vKCG$[:X$QU
}N'r@H)}]7gI
}r#Jj _,vn@@5Lo`
v;U'V0e(b3zA@2rh6E
function hidetext(){:L"I#^'e_{w7G
if (document.all)&Lex*E2ME
supertext.style.visibility="hidden"l4xiP"Q@eW
else if (document.layers)8FS-V.i{
document.supertext.visibility="hide"\"_Te f'{Ej4vs
clearTimeout(animatetext)
}
if (document.all||document.layers){"j%X)BIVn?rie
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>').d^r?"Lvd
window.onload = initializeBall;sNd?/MP*f1Y
window.onresize = new Function("window.location.reload()");.[ t4qND+O:E F
}5EEU sE
1?0uK%z$rH~q,sp
</script>
页:
[1]