网页之不断弹射的文字-特效
<style type="text/css">#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;+G*yjmq9P_%J*l
}X2cI4k:O(s
</style>
<script language="JavaScript1.2">;h&U]u(N.a!H
<!-- 改变下的字体的大小。颜色-->'l&T*I'~?
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';1d.[ o}VO,Mz
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;
var contentWidth;%Y3YD akKW%w
var contentHeight;
var maxBallSpeed = 50;&LO \~#`kM P p
var xMax;
var yMax;
var xPos = 0;
var yPos = 0;3L2oE,[7DU+pwn
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;It2T6a#oo#h
var tempBallSpeed;
var currentBallSrc;
var newXDir;-~Rd"^ J0UPF$j
var newYDir;%n f w6BxVu0o:|
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";gq[jB
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}
else if (document.layers) {~0L2pS[Y*U
xMax = window.innerWidth;MOC$OJp7cUY$O
yMax = window.innerHeight;(G,o/j7N#dvV(E
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}
G9U(vR7C_)U/wA
function moveBall() {D-^ xh|#|S6^
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;A+a e"_p0DN.k\
document.all("supertext").style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;Em'^m Pnl
} |)e'd'Uqcfo3y
animatetext=setTimeout('moveBall()',20);
}*|D-[d f z
}
\H,y;p$Lk5x
function calculatePosition() {
if (xDir == "right") {n|.K5@NP6q8w
if (xPos > (xMax - contentWidth - BallSpeed)) {.M Ce.k%~ oA
xDir = "left";
}6? @(P$Z3B9}uO+v
}.z#i*li-Q+I
else if (xDir == "left") {kb;N.C _6s Be]g5O
if (xPos < (0 + BallSpeed)) {
xDir = "right";5rh;r\6?\
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";} ek&a1D
} y:NZ4{ ?:u
},G B&P9Jtj,S*i
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {8Ez0v!B ]A }+C
yDir = "down";
}^ G:f3~9{
}
if (xDir == "right") {
xPos = xPos + BallSpeed;&P$kuh n}P0{6F
}|,j k#q-@2I(m3vVu
else if (xDir == "left") {\6|7`,p SR;_y#B
xPos = xPos - BallSpeed;
} hqZ-T _4FX g;~A
else {
xPos = xPos;
}
if (yDir == "down") { H*dh,V/dT
yPos = yPos + BallSpeed;fz{ x2~L
})iS2k&VhN4?mOs
else if (yDir == "up") {yuqkJ z9P bX
yPos = yPos - BallSpeed;
}
else {w2B:cy:Vd3k
yPos = yPos;$m\'Q$g@ ` hF/w
})FL}fCd%V#P#z3]
}k!}?RC
function hidetext(){6u3E~ K7U,{5Nq1c5w
if (document.all)]9FlH e
supertext.style.visibility="hidden"
else if (document.layers)W1Z CUl;K(?*W{G
document.supertext.visibility="hide"
clearTimeout(animatetext)
}aqpXqh\[
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')_l\Z _)`"Dt:M
window.onload = initializeBall;~r0s:a*K@
window.onresize = new Function("window.location.reload()");
}
</script>
页:
[1]