网页之不断弹射的文字-特效
<style type="text/css">3f#~7^'I,h&ZR#supertext {
position:absolute;
left:0;Tc)~Y$y,R-| Z
top:0;
visibility:hide;R ^'u[M(c
visibility:hidden;gUU5OW!f,z
}
</style>
<script language="JavaScript1.2">8Iz9?P.L&X B$|
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'M.t"ll t+Cs
var hidetimer='';YA#J$CC\l!V
<!-- 改变下的弹跳速度-->"C R O5u u
var BallSpeed = 20;c `8tE&qY4n2_0WR
var contentWidth;k"B:[mfy@
var contentHeight;o j qV!\1x
var maxBallSpeed = 50;
hnr IlN6A"y+i*`
var xMax;
var yMax; rH1f |Jn
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';9GR#C-b+g6I
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;
function initializeBall() {R5Hpp6H%rY
if (document.all) {(L'N e1S\c*y
xMax = document.body.clientWidth
yMax = document.body.clientHeight%@,eDk;t.}(SbbP
document.all("supertext").style.visibility = "visible";(G9V [3\5|j,|[
contentWidth=supertext.offsetWidth FUO ?!zrRhuv`
contentHeight=supertext.offsetHeight
}:g\Xz YDn:S+r
else if (document.layers) {
xMax = window.innerWidth;B'g\9cV'u-iOZ/]([
yMax = window.innerHeight;S {zb$u,i6v ]1]#t
contentWidth=document.supertext.document.widthRib9wn_ A9v
contentHeight=document.supertext.document.height4B e4nEuO8YHk
document.layers["supertext"].visibility = "show";
}VF6X(}$ozwRP$}0A"z&@
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)%ei%\ e aL
}8~iB6J+W9aZI(Y
y(g:] b4[?3W1xo[I^m
function moveBall() {
if (superballRunning == true) {
calculatePosition();^Bba3O:K
if (document.all) {I2jBQ+^S \ _4S"D
document.all("supertext").style.left = xPos + document.body.scrollLeft;p6bj~5Q
document.all("supertext").style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;$QY"aYD(x"P[$D
document.layers["supertext"].top = yPos + pageYOffset;0k8`e+jd m!e.n}
}
animatetext=setTimeout('moveBall()',20);
}Vt? [n7p3w"p
}
function calculatePosition() {
if (xDir == "right") {,q0@ZP8qjnD
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}\Fmt+RHR[
}
else if (xDir == "left") {+q!ZEw#V3dK4|6P
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}/qq*kN,RGKs
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}
else if (yDir == "up") {Im*f:S"K
if (yPos < (0 + BallSpeed)) {&m%^W_ [h)d&fe
yDir = "down";
}
}
if (xDir == "right") {g%L"AU8R#nZ S
xPos = xPos + BallSpeed;J-p[R0N!e&_oK
}7v U/Z_s
else if (xDir == "left") {
xPos = xPos - BallSpeed;4o Y a Z3ev|
}
else {
xPos = xPos;
}'{ O;F%x'[ BWZ7A y
if (yDir == "down") {
yPos = yPos + BallSpeed;)h7q v+ADk"v+oo/n
})w^{kg*a{g'_
else if (yDir == "up") {MR4YR0gZrL9i$E
yPos = yPos - BallSpeed;7Sa$I&i7EF L ^
}!F ]Hn8X)g
else {
yPos = yPos;
}
}2Rl'?v4Q t5J5`O
*]*zv3L Wq
function hidetext(){3BH0f,y|%L |
if (document.all)-qtH$~V&?
supertext.style.visibility="hidden"-d gfp%t1~SZ
else if (document.layers)s!Y!_M A4D:r
document.supertext.visibility="hide"
clearTimeout(animatetext)(M{p/Th!eGS
}v GhZY.lde@
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}
</script>
页:
[1]