发信人: xianfu163com(凤凰E站)
整理人: eagle(2002-01-29 09:05:06), 站内信件
|
=======================================================
JS-这个代码可以让你的网页里有样东西象桌球已弹来弹去哦!!
=======================================================
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>该页由梁献富(PhoenixGo/Legend)呕心编辑、倾情制作</title>
</head>
<body>
<style type="text/css">
#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
}
</style>
<script language="JavaScript1.2">
var thecontent='<h2>liangxianfu.go.163.com</h2>'//将这里改成你想要的文字即可
var hidetimer='';
var BallSpeed = 20;
var contentWidth;
var contentHeight;
var maxBallSpeed = 50;
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;
var newYDir;
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}
function moveBall() {
if (superballRunning == true) {
calculatePosition();
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);
}
}
function calculatePosition() {
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";
}
}
if (xDir == "right") {
xPos = xPos + BallSpeed;
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;
}
else {
yPos = yPos;
}
}
function hidetext(){
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>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}
</script>
</body>
</html>
---- 请诸位大虾指教:|[凤凰E站]||[emailto:phoenixgo]||[欢迎光临-凤凰E站-Welcome-To-PhoenixGo=动态特效-脚本技术=DynamicSpecial-JavaScript=最全-最新-超酷-超眩]||[★最新最好的软件--这里是共享软件注册中心--网路联盟,数百千万的软件,一定有适合您的一份★]||[★推荐加入极坐标,支持六层下线,四种交换方式,使您的流量立即倍增,让您的网站名气直升★]||[★加入凤凰链,支持五层下线,四种交换方式,使你的流量立即倍增,让你的网站人气直升★]||[本站的友情文本互换链接,你如有意加入,(请单击本行)与我联系。我会尽快将你的链接加入进来(8字以内文本,最好ip>100)]| |
|