查看完整版本: 图片满天飞舞

nothing 2008-1-1 15:31

图片满天飞舞

脚本说明:
第一步:把如下代码加入<head>区域中
<script language="JavaScript">
<!--//
//设置下面一些参数,小球移动速度1-50,数值大速度快;
var ballWidth = 40;
var ballHeight = 40;
var BallSpeed = 10;
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("superball").style.visibility = "visible";
      }
   else if (document.layers) {
      xMax = window.innerWidth;
      yMax = window.innerHeight;
      document.layers["superball"].visibility = "show";
      }
   setTimeout('moveBall()',400);
   }
function moveBall() {
   if (superballRunning == true) {
      calculatePosition();
      if (document.all) {
         document.all("superball").style.left = xPos + document.body.scrollLeft;
         document.all("superball").style.top = yPos + document.body.scrollTop;
         }
      else if (document.layers) {
         document.layers["superball"].left = xPos + pageXOffset;
         document.layers["superball"].top = yPos + pageYOffset;
         }
      setTimeout('moveBall()',30);
      }
   }
function calculatePosition() {
   if (xDir == "right") {
      if (xPos > (xMax - ballWidth - BallSpeed)) {
         xDir = "left";
         }
      }
   else if (xDir == "left") {
      if (xPos < (0 + BallSpeed)) {
         xDir = "right";
         }
      }
   if (yDir == "down") {
      if (yPos > (yMax - ballHeight - 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;
      }
   }
if (document.all||document.layers)
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
// -->
</script>
<style type="text/css">
#superball {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
width:40;
height:40;
}
</style>

nothing 2008-1-1 15:32

第二步:把如下代码加入区域中:
<span id="superball"><a href="http://www.javascript2000.com"><img name="superballImage" src="cat.gif" height="30" width="30" border="0"></a></span>

cora 2008-1-18 11:11

楼主找了多久啊...

Chester 2008-1-18 11:15

让人为了该帖而成立了各种学会来研究并为不同的理解争得眼红脖子粗的好帖?

E.T 2008-1-18 11:18

山外青山楼外楼,顶贴工作不能休!

nothindzerve 2008-1-18 11:23

我身在论坛,论坛却没有关于我的传说!

lingling 2008-1-18 11:29

你给我一个好贴,我还你一个顶贴!

loposr 2008-1-18 11:32

我顶之后,那怕后继无人,此帖都值了!!!

BFSH 2008-2-15 12:34

除非你不发,发了就要顶!

bgnaow 2008-2-28 21:51

泱泱论坛,顶帖为本!

bgnaow 2008-3-5 12:30

泱泱论坛,顶帖为本!

bgnaow 2008-3-7 16:39

泱泱论坛,顶帖为本!

bhanx 2008-3-8 15:05

中国队进球了我会出高呼 “好球” 此帖出现了 我会呐喊 “好帖”~~

zoe. 2008-3-15 08:46

值得探讨!!

zoe.z 2008-3-16 09:33

有些道理~~

zoe.z 2008-3-17 08:37

有些道理~~

zoe.z 2008-3-18 11:36

铁达尼沉了,没办法。帖子沉了,顶起来!

zoe14 2008-3-19 12:54

身为楼主,就算有8千个马甲,还是输给我

zoe14 2008-3-20 09:14

路过的人,支持,支持!!

花香满衣 2008-3-20 19:39

呵呵

跟VB似的,看不懂啊!

danzoo 2008-3-21 10:06

很实用的代码!保存了!谢谢!

源宾 2008-3-21 10:34

:L

Pam ^_^ 2008-3-21 11:24

直到其它被置顶以后我才后悔莫及!

pan 2008-3-25 11:37

如果上天可以给我再来一次的机会, 我一定说: 我顶!我顶顶!我顶顶顶!

pan 2008-3-25 11:38

如果上天可以给我再来一次的机会, 我一定说: 我顶!我顶顶!我顶顶顶!

pan 2008-3-25 11:44

男子汉即使遇到超级无聊的帖子…也不能错过

shinybaby 2008-3-26 06:03

好贴,置顶的首选。

Shirley 2008-3-27 12:37

好东西与好朋友分享。

shirleyred 2008-3-28 09:19

好好学习,天天顶贴!

shirleyred 2008-3-29 14:06

好好学习,天天顶贴!

shirleyred 2008-3-30 12:20

好好学习,天天顶贴!

shirleyred 2008-3-31 11:59

好好学习,天天顶贴!
页: [1]
查看完整版本: 图片满天飞舞
5.12四川大地震