Script to move text away from mouse?
November 24, 2006 2:35 PM   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 answers 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


Response by poster: 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 Make itunes fill up my ipod!   |   Ashes to Ashes Newer »
This thread is closed to new comments.