网页之不断弹射的文字-特效
<style type="text/css">#supertext {
position:absolute;JM-t7CdLB;p
left:0;
top:0;yR@B"l Iu
visibility:hide;&c,VL H$f
visibility:hidden;k^ ^Mc.];A7i$]B
}
</style>J A.MxD }i,U!i/SO
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->@T n(WW O*lZt
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer=''; Ul?/u*]2G4l)[O0e
<!-- 改变下的弹跳速度-->,g1Q(? |"f
var BallSpeed = 20;1dW(hF0A!]dTr
var contentWidth;
var contentHeight;
var maxBallSpeed = 50; Y qR&~n#QsE
Qd.i x%if8Ip,E-P
var xMax;
var yMax;
var xPos = 0;5_R7WxV)Cs
var yPos = 0;ao&@|7i
var xDir = 'right';
var yDir = 'down'; M"l#dG6Bry/Q
var superballRunning = true;I%VQe-{tM/[
var tempBallSpeed;
var currentBallSrc;XD FH/@8l
var newXDir;
var newYDir;
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight)}.g[(I2Ma%W*p
document.all("supertext").style.visibility = "visible"; T!R7v1{3pN1tAk(r]
contentWidth=supertext.offsetWidth5|c^V5v-}:n
contentHeight=supertext.offsetHeight
}!Y%O)?oJ-Bmy.d
else if (document.layers) {L#{?2I#Z b?:a
xMax = window.innerWidth;"mp+GDrZ-z9cK#T%d w,o
yMax = window.innerHeight;
contentWidth=document.supertext.document.width"j9AGlU"Ot |F1o
contentHeight=document.supertext.document.height*hB"X)cg2VG
document.layers["supertext"].visibility = "show";
}8a)u0rJ3dga
setTimeout('moveBall()',400);E8xE:uJ3I'~
if (hidetimer!='')/?5X`W9xg P;qP6Zq
setTimeout("hidetext()",hidetimer))\sf-i0`$A
}7Lu drY4m he2Q
function moveBall() {
if (superballRunning == true) {
calculatePosition();.gbq*zn&W7`
if (document.all) {B4G&?n?E `'?qP
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;6X2O+{%m,H%VolkJ"b
}-YD[5X j"v
else if (document.layers) {*RKX t cj5F|6c:e
document.layers["supertext"].left = xPos + pageXOffset;T/~&y-Ww,\H
document.layers["supertext"].top = yPos + pageYOffset;$^*iS$ZXH
}
animatetext=setTimeout('moveBall()',20);
}
}
G%L%~ W;ot ^
function calculatePosition() {&F9S8oC6v |/p _
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
};Q_+^9bwzF
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}+X-QjtI&R'N;kp X
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {P}[]Oj4J
yDir = "up";4pq G4c1@
}?+P7P }"[r5K:p n
}5f}!fCC9^C k0z3T
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";/M`h _ w
}+HS ezB
}
if (xDir == "right") {t#r6UfP
xPos = xPos + BallSpeed;B.c4uN/{6K!k%`&j]
}8j"r(wF4iB8V;z
else if (xDir == "left") {'bjHv,AqfO
xPos = xPos - BallSpeed;yC4~9dr$`Y s
}#jZ)Z0h7HU
else {E6AD#ytu
xPos = xPos;
}(L u2^'TIj,m
if (yDir == "down") {
yPos = yPos + BallSpeed;s B+rMt0th
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;q3X+At)g9\8RV:u#E
}.Q:M7w;|DI?
else {@HhT3\
yPos = yPos;4k,J6~,W!@k%c JgO
}
}A|x-])yG*i
function hidetext(){
if (document.all)}%I5J H+M"y#U(|
supertext.style.visibility="hidden"\x {/b2^k p~
else if (document.layers)GEh1AW8Xr
document.supertext.visibility="hide"
clearTimeout(animatetext)
}
p6z h!Dy ? e9f)I
if (document.all||document.layers){ {3vgS4h.`{2}cK
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')%o,L]^Q+G*q3D0y
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
} U,Hr,?!dcD
</script>
页:
[1]