ZoNT,
если повесить на боди див вообще не откроется, кнопка для открытия тоже в боди, ведь?
Я зарегистрировался, вот код с подсветкой:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style type="text/css">
#qw
{
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
display: none;
}
</style>
<script type='text/javascript'>
function findPosX(obj) {
var currleft = 0;
if (obj.offsetParent)
while (obj.offsetParent) {
currleft += obj.offsetLeft
obj = obj.offsetParent;
}
else if (obj.x) currleft += obj.x;
return currleft;
}
function findPosY(obj) {
var currtop = 0;
if (obj.offsetParent)
while (obj.offsetParent) {
currtop += obj.offsetTop
obj = obj.offsetParent;
}
else if (obj.y) currtop += obj.y;
return currtop;
}
function open_sk(x) {
bx = findPosX(document.getElementById('skbut'+x));
by = findPosY(document.getElementById('skbut'+x));
el = document.getElementById('qw');
di = document.getElementById('sk'+x);
di.style.left = bx;
di.style.top = by + 10;
di.style.visibility = 'visible';
el.innerHTML = di;
el.style.display = 'block';
}
function close_sk() {
el = document.getElementById('qw');
//el.innerHTML = '';
el.style.display = 'none';
}
</script>
</head>
<body>
<div id="qw" onclick="close_sk()"></div>
<div id="sk0" style="visibility: hidden; position: absolute;">000000000</div>
<div id="sk1" style="visibility: hidden; position: absolute;">111111111</div>
<button id="skbut0" onclick="open_sk('0')">Button 1</button>
<br><br><center>
<button id="skbut1" onclick="open_sk('1')">Button 2</button>
</center>
</body>
</html>