//漂浮的图片-----------------------------------------------------------
<script language="javascript">
var r=1;
var t=1;
function move()
{
var num1 = document.body.offsetWidth - document.getElementById("div1").offsetWidth;
<!--获取当前信息-->
var num2 = document.body.offsetHeight - document.getElementById("div1").offsetHeight;
if((document.getElementById("div1").style.pixelTop>num2)||(document.getElementById("div1").style.pixelTop<0))
t = -t;
if((document.getElementById("div1").style.pixelLeft>num1)||(document.getElementById("div1").style.pixelLeft<0))
r = -r;
document.getElementById("div1").style.pixelTop+=t;
document.getElementById("div1").style.pixelLeft+=r;
setTimeout("move()",10);
}
function Test()
{
var num = document.getElementsByTagName("input");
for(i=0;i<num.length;i++)
{
if(num[i].type=="button")
{
alert(num[i].value);
}
}
}
</script>
</head>
<body onLoad="move();Test()">
<div id="div1" style="position:absolute;top:200px;left:300px; z-index:1 ">
<img src="images/piaofu.jpg">
</div>