XY position of text cursor/caret in an editable iframe on key events
Is there a cross browser way to find the XY coordinates of the caret (as opposed to the mouse position, which is provided by mouse events) in an editable if开发者_Go百科rame on key events?
I've found this: http://www.codelifter.com/main/javascript/capturemouseposition1.html, in iframe mouse position is relative to iframe position:
<html>
<body>
<iframe src ="http://www.codelifter.com/main/javascript/capturemouseposition1.html" style="position:relative;left:25%;width:75%;height:500px">
</iframe>
</body>
</html>
The detection of mouse position you can find at page which i've wrote.
EDIT: I've find this article: http://parentnode.org/javascript/working-with-the-cursor-position/. And read comments, because there are fixed some bugs. Maybe it will help you :)
精彩评论