网页之不断弹射的文字-特效
<style type="text/css">#supertext {
position:absolute;b)[tYj?(u T
left:0;
top:0;
visibility:hide;8`,g u R[
visibility:hidden;
}
</style>H/eU j#K b0X_
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';
<!-- 改变下的弹跳速度-->{5[C;z:iW{
var BallSpeed = 20;
var contentWidth;
var contentHeight;
var maxBallSpeed = 50;
JZw(}!pI
var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;QY3A}_6Ia%V
var newYDir; F.V s*GOd/J
function initializeBall() {)XA$hpH9W.vQ^
if (document.all) {2R4~$T F'g|(z1N1d!K
xMax = document.body.clientWidth"ll"oj-X1F!b;R
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight(GH-W$B(yK/X
}~]x1]C~
else if (document.layers) {
xMax = window.innerWidth;2[sU%l*b*k
yMax = window.innerHeight;1{ }FbQ~9k:zVM
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}7kA$O-U3Z[
setTimeout('moveBall()',400);
if (hidetimer!='')G$Vx8aR/}9_
setTimeout("hidetext()",hidetimer)-?\/JH!q!a T_oP
}
function moveBall() {
if (superballRunning == true) { m Zk!D KM7G F
calculatePosition();1{ A#F6u2v^
if (document.all) {H~}R+r1e"VJ`
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;
}P:`6~:P~)j@_
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}5z@}.H }#ef
animatetext=setTimeout('moveBall()',20);8B5?;q!P6F!kZ:x
}$~5DRe:J8q
}{{@'V$\T|F
O6MH6]FZ&m1~
function calculatePosition() {Fj0U5Kp
if (xDir == "right") {'bS ?!|YN"v*`6Y
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}~'`2v\e%j&p
}
else if (xDir == "left") {b3Fc2wCh
if (xPos < (0 + BallSpeed)) {/e2B)J Y"L5{t$[h
xDir = "right";b2z4bd%DM
}c;PE$t X'ASA;gt
}
if (yDir == "down") {_gk|u0Y3w6i
if (yPos > (yMax - contentHeight - BallSpeed)) {E[U \9G
yDir = "up"; FV X0c Z1VL
}
}U/c y k)o }
else if (yDir == "up") {X*@4_p nc
if (yPos < (0 + BallSpeed)) {
yDir = "down";`3GH.{*aL3o S?
}t7s og^8N fH
}
if (xDir == "right") {
xPos = xPos + BallSpeed;})t yW#|`5mO
}5xg6m9V#l6[;N
else if (xDir == "left") {.@#y-c qtPBE)^
xPos = xPos - BallSpeed;
}
else {3}1aj b)e(gH
xPos = xPos;
}
if (yDir == "down") {])ymvl!C5s
yPos = yPos + BallSpeed;bXgpPC)w%g
}
else if (yDir == "up") {b8{"T"x"P-_T
yPos = yPos - BallSpeed;/[,}%}zf a3@ U
}
else {(S N3qY u
yPos = yPos;
}7m-R,d&Q*O7c
}r#r7UgE3_ _ x&e
w0O\dl/f!t+F4P
function hidetext(){x~b ` \:yOt
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"
clearTimeout(animatetext)
}
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')-u YtMLY%B
window.onload = initializeBall;sOG+h Ue8d
window.onresize = new Function("window.location.reload()");R#m(hA0}!kzE
}2tH:EaH:Hb
7bI U7d zH
</script>
页:
[1]