<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div style="width:100px;height:100px;position:absolute;right:20px;top:80px;background:#FFCC00;border:1px solid #999;"></div>
<script type="text/javascript">
<!--
 var i=0, str="";while(i++<100){str+="<br>"}
 document.write(str);
 var div = document.getElementsByTagName("div")[0];
 var y = parseInt(div.style.top);
 setInterval(function(){
  var cy = parseInt(div.style.top);
  var dy = document.body.scrollTop || document.documentElement.scrollTop;
  div.style.top = (cy + (dy -(cy-y))*0.1) + "px";
 },10);
//-->
</script>
</body>
</html>
posted on 2010-01-16 15:21  sweting  阅读(3244)  评论(0编辑  收藏  举报