RE: Help please ... Set caret position onmouseup
"Ryan Hicks" <[email protected]> Wed, 6 Sep 2006 09:38:28 -0700
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
I don't think that there is a solution for this that's cross-browser compatible. It works best in IE, where you can use the TextRange.moveToPoint() method to set the selection's TextRange to the x/y coordinates of the mouseup event. In Gecko browsers, there's no means to set the Range based on coordinates. You can get "close" by setting the style of the text field to a monospace font with a fixed character width, then setting the Range's startOffset to a character count based on pixel math from the x coordinate of the mouseup event. Sadly, however, there are no means to set the selection position in Safari. -ryan _____ From: [email protected] [mailto:[email protected]] On Behalf Of Brendan Gogarty Sent: Wednesday, September 06, 2006 7:02 AM To: [email protected] Subject: [wdf-dom] Help please ... Set caret position onmouseup Hi, - I need to drag an element over an <input type='text' field - When/if the mouse is released set the caret position in that field to the cursor position over it - Then paste text in that position input.selectionStart works in an onclick capacity but not in an onmouseup capacity. Tried using the a.click() function but that just emulates a click at the end of the text-range ... No luck from the WC3 DOM specs, so I thought I'd try here. Any ideas? regards brendan [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/7EuRwD/fOaOAA/yQLSAA/9rHolB/TM --------------------------------------------------------------------~-> Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wdf-dom/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wdf-dom/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/