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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the cursor location in a IFRAME

Status
Not open for further replies.

FadeOut

Programmer
Mar 27, 2004
14
0
0
CA
I want to get the cursor location (Integer???) in a IFRAME, with designMode set to On. Can Anyone can give me a hint on how to do so?

Thanx,

FadeOut
 
I imagine you would need to set an "onmousemove" event in the body of the document that is loaded in the iframe. Then you should be able to read the "event.OffsetX", "event.x", "event.screenX", or "event.clientX" (and Y, of course) values, depending on what you want the coordinates relative to.

Hope this helps,
Dan
 
cursor location i dont know about i know how you could handle the scroll position, if so, name the iframe, and onscroll report the value to a variable, and call it when you need it as per example :

i use a hidden form element, so if need be, after a post, the page can pre-scroll to the last position it was at :
function scrollval(arg)
{
document.theform.scrollpos.value = arg.scrollTop;
}

<input type="hidden" name="scrollpos" value="">
<iframe name="iFrameContent onscroll="scrollval(this);" <clip>...>

[thumbsup2]DreX
aKa - Robert
 
and if you need side scrolling too, just copy the line in the function and change scrolltop to scrollleft

you'd probably want to change the hidden value from scrollpos to scrollposY and add a scrollposX

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top