I am trying to write a dropdown menu and it was easy when I would position the dropdown part absolutely. But whenever I resize the browser or res my dropdown part is obviously displayed in the wrong place and not underneath the heading as expected.

Now I am trying to position the dropdown in relation to the position of the <td> it is supposed to display under. My problem is that when I reference it's pixelLeft/pixelTop properties it just returns 0.

Below is a sample of the script. Please don't laugh, I am starting out on DHTML. If you have any suggestions on how to do this or why the alerts I put in all return 0 please reply to this post.


#divBg {background-color:#ffffff; position:absolute; z-index:1; color:#e6e6e6; width:122px; height:10px; visibility:hidden;}


if(TextID=='mPhotos'){ document.all.divBg.style.pixelTop=document.all.spPhotos.style.pixelTop+20;
alert(document.all.spPhotos.style.pixelTop);
document.all.divBg.style.pixelLeft=document.all.spPhotos.style.pixelLeft+20;
alert(document.all.spPhotos.style.pixelLeft);
document.all.divBg.style.visibility='visible';
}
else{
document.all.divBg.style.visibility='hidden';
}

Thanx