Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving <div>

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
Hey everyone,

I am making a menu based on "hiermenus" and doing pretty well despite my limited (but quickly growing) knowledge of DHTML.

I have a set of menu categories and within those categories a bunch of items. I can expand and collapse the categories OK and have the ability to show a certain number of items within the category if there is a long list.

I then want to make the menu scroll the remainder of the items. i.e. say 6 are visible out of 15, when the user mouses over an arrow the 6 items will scroll up hiding #1 and revealing #7 and so on.

The categories are all one <div> and the items are nested <divs>

The outer being <div class=&quot;item&quot; id=&quot;itemmenu(n)&quot; where n is the category number.

The inner is <div id=&quot;(n)_(m)&quot;> where n is category, m is item number.

So it looks like
<div class=&quot;item&quot; id=&quot;itemmenu1&quot;>
<div id=&quot;1_1&quot;> </div>
<div id=&quot;1_2&quot;> </div>
</div>

here is the problem...

If I use this code;

menuItem = (&quot;1_2&quot;)
document.all(menuItem).style.background = &quot;#ff000&quot;

The correct item turns red - therefore I am obviously referencing the correct object.

However, if I use this;

menuItem = (&quot;1_2&quot;)
document.all(menuItem).style.top = &quot;200px&quot;

it doesn't move.

I have tried all sorts of variations on quotes and using &quot;:&quot; instead of &quot;=&quot;, but with no joy at all.

Does anyone have any idea on what I am missing.

THanks heaps in advance


Steve Davis
hey.you@hahaha.com.au
 
try document.all(item).offsetTop=200
or document.all(item).style.pixelTop=200
or document.getElementById(item).offsetTop=200
or document.getElementById(item).style.pixelTop=200
or for nc:
document.layers.top=200

note: 200, not &quot;200px&quot;

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top