CSDN博客

img IMAGSE

漂浮在页面中不随内容滚动的div

发表于2008/10/1 0:16:00  1523人阅读

<html>
<head>
<title>OnScroll Example </title>
<script type="text/javascript">
window.onscroll = function () {
var oWatermark = document.getElementById("divWatermark");
oWatermark.style.top = document.body.scrollTop;
}
</script>
</head>
<body>
<p>Try scrolling this window. </p>
<div id="divWatermark" style="position: absolute; top: 0px; right: 0px; color: #cccccc; width: 150px; height: 30px; background-color: navy"><input type="button" value="Click Me" onclick="alert('Hello!~~')" /> </div>
<p>Line 1 </p>
<p>Line 2 </p>
<p>Line 3 </p>
<p>Line 4 </p>
<p>Line 5 </p>
<p>Line 6 </p>
<p>Line 7 </p>
<p>Line 8 </p>
<p>Line 9 </p>
<p>Line 10 </p>
<p>Line 11 </p>
<p>Line 12 </p>
</body>
</html>
0 0

相关博文

我的热门文章

img
取 消
img