iframe relative mouse position

Giganews Newsgroups
Subject: iframe relative mouse position
Posted by:  mik…@cs.cmu.edu (madmike)
Date: 16 Jul 2003

Hi,

I have an iframe with some javascipt that gets the mouse x and y
position like  this:
//inside the iframe's onmousemove call back  funciton
xMousePos = window.event.clientX + document.body.scrollLeft;
yMousePos = window.event.clientY + document.body.scrollTop;

This gets the x and y position inside the iframe. But what I want is
the x and y position of the parent window, not the screen like
screenX. Is there any easy way to get parentX and parentY or to get
the offset x and y of the iframe relitive to the parent from inside
the iframe?

thanks in advance,
mike

Replies