浮动的对联
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var initTop=0;
var initTop2=0;
function initTop()
{
initTop=document.getElementById("divLayer").style.pixelTop;
initTop2=document.getElementById("divLayer2").style.pixelTop;
}
function move()
{
document.getElementById("divLayer").style.pixelTop=initTop+document.body.scrollTop;
document.getElementById("divLayer2").style.pixelTop=initTop2+document.body.scrollTop;
}
window.onscroll=move;
</script>
</head>
<body onLoad="initTop()" >
<div id="divLayer" style="position:absolute;width:150px;height:200px;left:16px;top:150px; z-index:1;" >
<img src="img/dragon.jpg">
</div>
<div id="divLayer2" style="position:absolute;width:150px;height:200px;right:16px;top:120px;z-index:1">
<img src="img/dragon.jpg">
</div>
<img src="img/black.jpg">
<img src="img/black.jpg">
<img src="img/black.jpg">
</body>
</html>
浮动的对联为什么靠top浮动