[thelist] div's pixel coordonates

jon steele jjsteele22 at yahoo.com
Sun Apr 21 17:59:02 CDT 2002


--- Catalin Salagean <cds at orizont.net> wrote:
> Is there a way (mainly Javascript) to find out the exact pixel coordonates of a given <div> ?
> I'm trying to adapt a script that scrolls a div, and I need to position this div inside my
> liquid design..

Hi,

3 ways to do for three different browsers:

NS4 -
document.layers['layername'].top  //y
document.layers['layername'].left //x

NS6/IE5+ -
document.getElementById("layername").style.top  //y
document.getElementById("layername").style.left //x

IE4 -
document.all.layername.style.posTop  //y
document.all.layername.style.posLeft //x

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/



More information about the thelist mailing list