G
Gernot Frisch
I want to center the div "KungFu" over the div "header".
Does not.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//DE">
<html>
<body>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>
<br>
<nobr>
<br>
<div id="header">HERE IST THE HEADER</div></p>
</nobr>
<div id="KungFu"></div>
<script type="text/javascript">
//
//
//
function displayFloatingDiv(divId, title, message, center_over_Id,
width, height)
{
var left, top;
var parent = document.getElementById(center_over_Id);
left = Math.max(0, parent.offsetLeft+ (parent.offsetWidth-width));
top = Math.max(0, parent.offsetTop+ (parent.offsetHeight-height));
var Div = document.getElementById(divId);
Div.style.position = 'absolute';
Div.style.width = width + 'px';
Div.style.height = height + 'px';
Div.style.left = left + 'px';
Div.style.top = top + 'px';
alert(parent+' - l:'+left+' t:'+top+'
w:'+(parent.offsetWidth-width));
var addHeader;
addHeader = '<table style="width:' + width + 'px" bgcolor="red">'
+
'<tr><td
onclick="document.getElementById(\''+divId+'\').style.visibility=\'hidden\'">'
+ title + '</td>' +
'<td style="width:18px" align="right">' +
'Close...</td></tr><tr><td
colspan="2">'+message+'</td></tr></table>';
// add to your div an header
Div.innerHTML = addHeader;
Div.className = 'dimming';
Div.style.visibility = "visible";
}
displayFloatingDiv("KungFu", "Title", "Some long message", "header",
320, 240);
</script>
</body></html>
Does not.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//DE">
<html>
<body>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>
<br>
<nobr>
<br>
<div id="header">HERE IST THE HEADER</div></p>
</nobr>
<div id="KungFu"></div>
<script type="text/javascript">
//
//
//
function displayFloatingDiv(divId, title, message, center_over_Id,
width, height)
{
var left, top;
var parent = document.getElementById(center_over_Id);
left = Math.max(0, parent.offsetLeft+ (parent.offsetWidth-width));
top = Math.max(0, parent.offsetTop+ (parent.offsetHeight-height));
var Div = document.getElementById(divId);
Div.style.position = 'absolute';
Div.style.width = width + 'px';
Div.style.height = height + 'px';
Div.style.left = left + 'px';
Div.style.top = top + 'px';
alert(parent+' - l:'+left+' t:'+top+'
w:'+(parent.offsetWidth-width));
var addHeader;
addHeader = '<table style="width:' + width + 'px" bgcolor="red">'
+
'<tr><td
onclick="document.getElementById(\''+divId+'\').style.visibility=\'hidden\'">'
+ title + '</td>' +
'<td style="width:18px" align="right">' +
'Close...</td></tr><tr><td
colspan="2">'+message+'</td></tr></table>';
// add to your div an header
Div.innerHTML = addHeader;
Div.className = 'dimming';
Div.style.visibility = "visible";
}
displayFloatingDiv("KungFu", "Title", "Some long message", "header",
320, 240);
</script>
</body></html>