关于用Javascript写获取当前div高度,鼠标滚动一下显示对应高度怎么写?例如下面这个事例,我用鼠标滚动一下,显示page1的高度,再滚动一下,显示page2的高度。这样怎么写?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
.main{width: 100%; height: auto;}
#page1{width: 100%; height: 600px; background: red;}
#page2{width: 100%; height: 500px; background: yellow;}
#page3{width: 100%; height: 700px; background: green;}
#page4{width: 100%; height: 400px; background: blue;}
</style>
<script type="text/javascript">
window.onload=function()
{
var page1=document.getElementById("page1");
page1.style.height='600px';
}
</script>
</head>
<body>
<div class="main">
<div id="page1">1</div>
<div id="page2">2</div>
<div id="page3">3</div>
<div id="page4">4</div>
</div>
</body>
</html>
SuperManSuperWorld
相关分类