blob: 4e7e090eba17174fc58c36f432448b768eb5b858 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<style>
.boundary { overflow: hidden; width: 100px; height: 50px; }
</style>
<div>
<div class="boundary" style="height: 150px;">
<div style="position: relative;">
<div style="height: 10px;"></div>
<div class="boundary" style="position: absolute;">
<div id="first" style="background-color: red; width: 0; height: 50px;">
</div>
</div>
<div class="boundary" style="margin-top: 50px;">
<div id="second" style="background-color: red; width: 0; height: 59px;">
</div>
</div>
</div>
</div>
</div>
<script>
function test()
{
var first = document.getElementById("first");
var second = document.getElementById("second");
first.style.width = "100px";
first.style.backgroundColor="green";
second.style.width = "100px";
second.style.backgroundColor="green";
}
document.body.offsetTop;
test();
</script>
|