<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
var timer;
window.onscroll= function()
{
var oDiv = document.getElementByIdx_x("div1");
//oDiv.style.top = document.body.scrollTop; //不加dtd可以兼容
oDiv.style.top = document.documentElement.scrollTop //加dtd可以兼容
}
</script>
</head>
<body>
<div id="div1" style=" position:absolute; width:100px; height:100px; background:#FF0000"></div>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p><p><textarea rows="15" cols="50" id="text1"></textarea></p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
<p>ssssssssssss</p>
</body>
</html>
posted on 2011-06-03 21:44
aya000 阅读(153)
评论(0) 编辑 收藏