网页之不断弹射的文字-特效
<style type="text/css">N ae5lYf$y{#E#supertext {
position:absolute;
left:0;
top:0;lx%a:zFS
visibility:hide;
visibility:hidden;9k%}P#U0JS;K"w2^i%JW.Y
}BF%v4Q"W
</style>
<script language="JavaScript1.2">k)mx7gx$H
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'onyu6{I6a,y_G;\{
var hidetimer='';jmu+PPQkX[
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;
var contentWidth;~)qc2^ S2r
var contentHeight;
var maxBallSpeed = 50;7@W)w}X4C"bXe*U
k8D#l:L!b*G
var xMax;
var yMax;
var xPos = 0;:}gS%[:ux"j
var yPos = 0;
var xDir = 'right';
var yDir = 'down';dNV-x*{RXiA}
var superballRunning = true;&QMT-T@$v2u _
var tempBallSpeed;oJ(E{%F9k F J+d
var currentBallSrc;k w-F'ei0NL z-V l
var newXDir;7k8cW~-Q7D ~
var newYDir;
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth:O&g8D*Cbt h`
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";X\?-UbFn [*U
contentWidth=supertext.offsetWidth}z Kxjc%O9F5VK
contentHeight=supertext.offsetHeight
}uRI+p|N GqG4sl
else if (document.layers) {
xMax = window.innerWidth;#O-lg']h+TXe
yMax = window.innerHeight; ` r{"c&e'q.i
contentWidth=document.supertext.document.width|5s(?;I!U6na5r
contentHeight=document.supertext.document.heightP'Sg-N%GG#N#q)F
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);D f|t&U4]R
if (hidetimer!=''):Aq.t(ds
setTimeout("hidetext()",hidetimer)9t*w^yW E%o3O
}fP @ cm+Yk|
i}S+g9U0ED
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;y{j1k7T cNg2A3`
}
else if (document.layers) {}9gVON1W`V%y
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}
animatetext=setTimeout('moveBall()',20);YyM)rL
}"rk y*m6aH1\'f)`I ^
}A~}~u\[
P!B#M BY
function calculatePosition() {!\C RQ-jW~G7| oL
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";)U])My_9K
}vY$U:y7h+yA@ t
}_?,JS|&`+V
else if (xDir == "left") {_)K;Q9hA/m
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}3lv@IIe
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {)j/V1V,dIoW
yDir = "up";+pTE%n s G~~
}8UxM }&Z3v)s$E;L
}
else if (yDir == "up") {&K;oU7rR!L@
if (yPos < (0 + BallSpeed)) {\ Md*LT Cw)X
yDir = "down";
}
}
if (xDir == "right") {
xPos = xPos + BallSpeed;-L+Td+L*qA'I3n
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;
},Ln"L P/k8Po
else {
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;c*d$b'Cx/t CKnT
}7k&?%k.@-p#?,q,_
else if (yDir == "up") {4dS,Wg#fp
yPos = yPos - BallSpeed;4[ k*p-pds!i&sN
}
else {q?c$x0W)y^5m,Q#L9t
yPos = yPos;
}i+?Wn[d*\
}p C C\FP,O KF+t(H
D2Cbc1OA c6@)Q7`,U
function hidetext(){8ITA ivg&O*?.Z.x$W
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)U{1wF Gaa
document.supertext.visibility="hide"
clearTimeout(animatetext)0u-f6CU!ZXhDO^$h
}
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;p4{#z%f gpp$_
window.onresize = new Function("window.location.reload()");9].N-AeuN$g/p8C8CB(q
}!^#[j W5l'f5R/O4P R*r
</script>
页:
[1]