网页之不断弹射的文字-特效
<style type="text/css">#supertext { oV&S [V
position:absolute;8jF3s+RO$E&S/z
left:0;JBU [!b
top:0;
visibility:hide;0SQ"yu6JL ]7KU
visibility:hidden;
}
</style>6{/XwI{Q7N
<script language="JavaScript1.2">
<!-- 改变下的字体的大小。颜色-->m*wS[#p'h
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
var hidetimer='';
<!-- 改变下的弹跳速度-->
var BallSpeed = 20;'R9V?7f\l4F
var contentWidth;
var contentHeight;tWPZ)Q d]E:N6~O
var maxBallSpeed = 50;
m)jbk"sr7u_ `
$c]%h.iX.ZIa
var xMax;J{a\#j"yAs
var yMax;"bWEoG*|,NE"eA
var xPos = 0;
var yPos = 0;
var xDir = 'right';qy5Yf6]n6a&L
var yDir = 'down';
var superballRunning = true;n v(ZUk^
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;t0Ob:l o _"F
8nx7~wH)j&Y6u/x
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidthz/B @0c];u&Rx
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth7zap%s:o` \
contentHeight=supertext.offsetHeight
}%C D+gZ!Io\w e
else if (document.layers) {
xMax = window.innerWidth;f0q2S1m6{,?M:k"I
yMax = window.innerHeight;,bX"p6Zy)l
contentWidth=document.supertext.document.widthgu(J~C(p-LhiX
contentHeight=document.supertext.document.height8k/Vy\ q,G'Rqa
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)nq!~3a~3H0]8O
}
function moveBall() {,tk)n1c"X
if (superballRunning == true) {
calculatePosition();r:N!Ia5{V|
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
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;
}
animatetext=setTimeout('moveBall()',20);"s{:S v:w\3t
}K i+ks{w B
}yD v(M.mu ~i`J
l&O.[G/S/^2i
function calculatePosition() {9?Rb6W c4e
if (xDir == "right") { J#t+G3F)Hq#|+e
if (xPos > (xMax - contentWidth - BallSpeed)) {z*d7Kk:P
xDir = "left";^4S&P$}-tyP5_T
}$E.xO(bH!T]!g
}"q#B.K ft,h2z)t
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}}R+gxR9k
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {a9Zn3tr
yDir = "down";~8DPF:})G W
}~QRXpR;t0}#o
}VJ2_ Zy3_/Q
if (xDir == "right") {
xPos = xPos + BallSpeed;gg\JU0[ n/IM]z
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;FydCl:Ul&l
}
else {~l jY)Zz |
xPos = xPos;
}C&mL n]z/A
if (yDir == "down") {!o p&pZ;V(T"q-Wt
yPos = yPos + BallSpeed;q,F(t S ~
}
else if (yDir == "up") {|h_ I,l'r8C9qJ;Lo
yPos = yPos - BallSpeed;
},e.r%w5l`"|1h
else {
yPos = yPos;Z0k}z|
}m+pITB
}
function hidetext(){
if (document.all)8D:D*}"K1dB
supertext.style.visibility="hidden"
else if (document.layers)@RJ[:P4||
document.supertext.visibility="hide" E9l%i~6b&^ z
clearTimeout(animatetext)(q ?],\nLv,mO"JV:V
}nYFC qD$sJI
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')5m/`ZlC1^~5@
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");r)V5X z,^ `
};r;E,Wyj d7H,Pk*Q
</script>
页:
[1]