...

View Full Version : Positioning a div



ScottInTexas
10-15-2003, 02:44 PM
I am trying to position the div 'ele' on the left edge of the containing div. If I ever get this positioning stuff figured out...

Here's what I am trying to do.




<div id="container">
<div id="div1">
some stuff
</div>
<div id="div2">
some stuff
</div>
<div id="div3">
some stuff
</div>
</div>

************** the javascript

function showDiv(aDiv){
var ele=document.getElementById(aDiv);
ele.style.width=ele.clientWidth;
alert("Left=" + ele.clientLeft);
set the left position;
ele.style.visibility="visible";
}



All the divs are invisible. In another part of the page the onClick fires the javascript and passes the id of the wanted div. The wanted div should fill the container. I guess I could be using layers and changing the z-index or something, but I don't know anything about layers.

I must become one with positioning. I will remain in meditation and the lotus position while I await enlightenment.

Thank you.

sciguyryan
10-15-2003, 08:43 PM
You will have to use CSS' position:absolute atribute.

ScottInTexas
10-15-2003, 09:10 PM
Thank you.

I have gone around the bend on this. Finally I have some control over where the div shows up. I would like to get the available clear area of the container (without scroll bars) to display my div in. I am looking a offsetHeight, offsetWidth etc. to do this. If you have any hints I would love to hear them.

sciguyryan
10-16-2003, 04:53 PM
What do you mean by offste? If you could explain then i will do my best to help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum