473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

center div over another div


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>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>

<br>
<nobr>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<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+'\').st yle.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>
Mar 16 '06 #1
1 7431
Gernot Frisch said the following on 3/16/2006 8:10 AM:
I want to center the div "KungFu" over the div "header".
Does not.


news:comp.infosystems.www.authoring.stylesheets is a better place to ask
CSS questions.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mike | last post by:
We are using: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"...
7
by: Alex | last post by:
Hi Everone, I need some advice on how to setup 4 columns where the outside two are absolute (120px) and the inner two (side by side) are relevent (Fluid) and change with the screen. Here's my...
3
by: Mike | last post by:
Another complaint I would like to see corrected. The Information Center tool is now pretty much useless to me. Does anyone else besides me remember when information center had a troubleshooting tab...
9
by: klh | last post by:
We are running on Win 2003/DB2 V8 FP7a. My question concerns Task Center. I have about 200 tasks created and scheduled in Task Center. We are going to be moving many of the databases from this...
3
by: tshad | last post by:
I have the following: <tr valign="baseline"> <td align="center" width="103" colspan=2 nowrap> <asp:Button ID="ViewPositions" runat="server" Text="View Positions" OnClick="ViewPositions_Click"...
11
by: Hoku | last post by:
I am using dual monitors on a dual head ATI AGP4x video card. I installed the Nov 11 2005 release of ATI's catalyst control center with Hydravision to manage the dual monitor setup. I recently...
1
by: Matt | last post by:
I have taken a backup of a production database and copied it to a test server. I'm attempting to use the Control Center to create the database from the backup. However, when I get to the screen...
5
by: kdfake | last post by:
I cant figure out how to do it... Any clues? R -- --------------------------------- --- -- -
14
by: Summercool | last post by:
in http://www.0011.com/test_size3.html to center the logo "HTML 4.01 check" button at the bottom of the page, I used <div style="width: 10px; margin: 0px auto"> </div>
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.