Script to move text away from mouse?
November 24, 2006 2:35 PM   RSS feed for this thread Subscribe

I need some Javascript code to cut and paste which will move some text away from the mouse! Can anyone help?
posted by BobsterLobster to computers & internet (3 comments total)
my greasemonkey script - Comment is an example that uses mouse selection, and range objects.

In it, I explicitly use range.cloneContents() so that the selected text does not disappear and a copy appears elsewhere. If I hadn't used cloneContents() the text would have moved.
posted by MonkeySaltedNuts at 3:07 PM on November 24, 2006


Also you didn't say why you wanted such code. For inclusion in a web page? For a userscript? Do you want to move just plain text? or the underlying HTML?

It may be that my example uses Mozilla specific features that won't work in IE. It has been a while since I wrote it and I vaguely remember some differences.

But since it is a Greasemonkey script, I only have to worry about it working in Firefox.
posted by MonkeySaltedNuts at 4:01 PM on November 24, 2006


I wanted it on a webpage, so that a layer would move away from any visitor's mouse. Ah well.
posted by BobsterLobster at 11:00 AM on November 26, 2006


« Older How do I tell itunes to just d...   |   Cricket. Ashes. Where?... Newer »

You are not logged in, either login or create an account to post comments



Related Questions
Help me AJAXify a portion of my project without... January 8, 2008
jQuery vs. Scriptaculous November 16, 2007
How to Sanitize HTML (Javascript Security) September 3, 2007
Mark CF, if you're reading this, shoo! January 23, 2007
Your favorite web design tricks? March 16, 2006