网页之不断弹射的文字-特效
<style type="text/css">#supertext {
position:absolute;kl)Dngs.Zp
left:0;
top:0;
visibility:hide;
visibility:hidden;cX6dAe0[B
} |;RDlUF @
</style>T8F0hu*xTO1{1w
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色--> _Lj"X[3h_%Y'C
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'U+QW;t ` {
var hidetimer='';
<!-- 改变下的弹跳速度-->)f2sqh4X1y XSX
var BallSpeed = 20;
var contentWidth;
var contentHeight;
var maxBallSpeed = 50;
Gwy)CHa7?P]j*o"W
Nh}M9Y d#l;H
var xMax;
var yMax;)y CPT!k-p
var xPos = 0;$EPnR7US
var yPos = 0;\!q Ss0S9x
var xDir = 'right';lLGAj
var yDir = 'down';
var superballRunning = true;)H.d1K0u/as
var tempBallSpeed;S(c$H#{%i
var currentBallSrc;
var newXDir;
var newYDir;
6uijfC7K(e%V }p%Rw
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth8i6@'Dd9B
yMax = document.body.clientHeight]#G [4p5}VgO
document.all("supertext").style.visibility = "visible";q?WEX2U'I6E
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeighte%?_dGSE
}+LO:{mj.D~teI
else if (document.layers) {I:c:q)Lr
xMax = window.innerWidth;?e;EDH)Gd5f
yMax = window.innerHeight; Sun!j0PJ
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}x-TJA?TNu
setTimeout('moveBall()',400);
if (hidetimer!='')r4l*g"Wc'h/SMY6^
setTimeout("hidetext()",hidetimer)
}
function moveBall() {Rh"{B6A'm
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;.e'w~n@e w k/D;S
document.all("supertext").style.top = yPos + document.body.scrollTop;(S+Z8S!hx+A
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}G2NNf%]j,V
animatetext=setTimeout('moveBall()',20);
}
}
i N3My,P tq,\)r3V
function calculatePosition() {
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {)cn5|:yG
xDir = "left";
}^-i0C4N%EPN;x VY
}T#ZPz|z
else if (xDir == "left") {sUNq W
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}0A%V(D7H6a T
} cL0Nl$bEe MV
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {L0MAMy&I-z%k yH
yDir = "up";A4vPfwe_g4I*d8U|
}
}
else if (yDir == "up") {],Bu0S|;s
if (yPos < (0 + BallSpeed)) {
yDir = "down";'z!BJ'X A p/[s
}
}| c9N;Fe.E T
if (xDir == "right") {
xPos = xPos + BallSpeed;aWt1C^;?#NU
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;
}
else {M,J[#A/O
xPos = xPos;!s@1c+|s/_\0g
}
if (yDir == "down") {jdg/u\5M-Y6`BE
yPos = yPos + BallSpeed;/Izekr9L
}
else if (yDir == "up") {4K4BI@,r4PRf*q%m
yPos = yPos - BallSpeed;~Y%wZ5p+R&`
}
else {
yPos = yPos;
}"CGE|W(d G,Ty
}6Md/G+cIK YN5cZ
function hidetext(){
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"2S\MK%h%?-Kz
clearTimeout(animatetext)lK;U:{(v#T
}
b]#n.X~AmE
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}
UA&QIx c
</script>
页:
[1]