Click to See Complete Forum and Search --> : Menu Newbie


kmcnet
04-12-2003, 12:57 AM
Hello Everyone. I am a newbie to both DHTML and Janascript. I am trying to put together a drop down menu and am running into problems. I have posted an example at:

http://www.hughmclaughlin.com/scripttest2.aspx

I am trying to learn do dynamically postion elements on a page based on the postion, height, and width of parent elements. However, I am not having much luck. Can someone tell me what I am doing wrong? Any help would be greatly appreciated. Thanks.

khalidali63
04-12-2003, 11:54 AM
change these lines of code

blockElement.style.left = myElementx+ 'px';
blockElement.style.top = myElementy + 'px';

to these

blockElement.style.left = myElementx+40 + 'px';
blockElement.style.top = myElementy +20+ 'px';

Is that what you wanted?

Cheers

Khalid

kmcnet
04-12-2003, 12:15 PM
Thanks for your reply. Perhaps I am not understanding your response, so please bear with me. I am trying to dynamically position the elements. It seems that the code you suggest is using a fixed value as the offset. Am I correct?

khalidali63
04-12-2003, 02:54 PM
"Dynamically"
....you will have to be more descriptive.
As I understand, though its dynamic positioning ,it will have some co-ordinates,you must want your menu to appear at some point on the page or ur intention is that the menu may appear anywhere on the page?

My earlier post still gets the myelements position ,but only adds values to it for better positioning.

try the above and if its not what you want then you have to be more descriptive about your question

:D

Cheers

Khalid

kmcnet
04-12-2003, 03:26 PM
Again thanks for your help. I gave it a try and it did work. However, it has still left me with a couple of questions:

1. Why do you need to make the adjustments? I thought getting the offsetTop and offsetHeight would give me the appropriate palce to start without adjustments.

2. When I make these adjustments, I can no longer mouseover the submenus since they close. Is this where I need to implement a timer to set up a delay? Any examples of how to implement this? Thanks again.