浮动div以及div透明
div随滚动条的滚动而不断滚动
//脚本实现滚动
<script language="JavaScript" type="text/JavaScript">
function scrollLayer(){
var t = window.pageYOffset; //获取滚动条坐标
if (isNaN(t)) {
t = document.documentElement.scrollTop; //页面使用W3C标准,获取滚动条坐标
}else if (isNaN(t)) {
t = document.body.scrollTop; //其他情况获得滚动条坐标
}
t+="px"; //为坐标加上单位px,以符合W3C标准
document.getElementById("Layer1").style.top =t;
}
window.onscroll=scrollLayer;
</script>
<div id="Layer1" style="position:absolute; width:200px; height:50px; z-index:1; background-color: #00FFFF; layer-background-color: #00FFFF; border: 1px none #000000; left: 0px; top: 0px;filter:Alpha(opacity=40)"></div>
//filter:Alpha(opacity=40) 设置透明度