87,994
社区成员
发帖
与我相关
我的任务
分享
<!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>
<title> new document </title>
</head>
<body>
<div id='oimg' style="position:absolute;left:100px;top:300px;width:100px;height:100px;border:1px solid red;background-color:#00FF33">假如我是图片</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<script type="text/javascript">
<!--
(function(){
var o = document.getElementById('oimg');
var t = o.offsetTop;
var d = 0;
window.onscroll = function(){
var de = document.documentElement || document.body;
d = de.scrollTop;
o.innerHTML = d
if(de.scrollTop >= t){
o.innerHTML = "到达顶部";
de.scrollTop = t;
return false;
}
}
})();
//-->
</script>
</body>
</html>