By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,695 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,695 IT Pros & Developers. It's quick & easy.

How to get UL coordinates and size?

P: n/a
Hello.

I have several nested undordered lists like this:

<ul id="menu">
<li>1. First item</li>
<li>2. Second item
<ul>
<li>2.1. Sub item</li>
</ul>
</li>
<li>3. Third item</li>
</ul>

With that structure and CSS and some javascript you can make a drop-down
menu. See for example http://www.alistapart.com/articles/horizdropdowns/

I have a problem with these menus and windowed controls (like a list
box) in MSIExplorer. The list box is always over the drop-down menu.

I have seen a method to put the drop down menu over the list box. You
can read it here:
http://dotnetjunkies.com/WebLog/jkin...07/21/488.aspx

To cover the list box I have to shim an IFRAME under my root UL. To do
that I need to get the UL coordinates and its width and height.

How can I do that?

I have tried this:
ul=document.getElementById('menu');
ifrWidth=ul.offsetWidth;
ifrHeight=ul.offsetHeight;
ifrTop=ul.style.top;
ifrLeft=ulstyle.left;

but it doesn't work. The ul's width and height doesn't include the
nested lists and the top and left propoerties are 0.

I have uploaded an example to this URL:
http://www.tel.uva.es/~jpozdom/cssmenu/cssmenu.html

Bye and thanks in advance.
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jesús Ángel wrote:
[...]
To cover the list box I have to shim an IFRAME under my root UL. To do
that I need to get the UL coordinates and its width and height.

How can I do that?

[...]

Have a read here:

<URL:http://www.quirksmode.org/js/findpos.html>

--
Fred
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.