ckrudelux Posted June 24, 2009 Share Posted June 24, 2009 I'm in need of a javascript what would work like this:1. press and hold on a text row.2. Move to input field or textarea.3. release and the text is pasted.This is like drag, select a area of text and move it to textarea and it will paste. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 24, 2009 Share Posted June 24, 2009 You wouldn't be able to do that with arbitrary text, only on certain elements. You could drag an entire div, but not just highlight some text in the div and drag it. Is that what you want to do? Link to comment Share on other sites More sharing options...
aalbetski Posted June 24, 2009 Share Posted June 24, 2009 IE has the ability to create a TextRange object and copy and paste using the clipboard. Don't know about the other browsers. You can also set the contentEditable property to true and it does all the work <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <body> <div contentEditable="true"> Select a word and drag it around </div> </body></html> Link to comment Share on other sites More sharing options...
ckrudelux Posted June 24, 2009 Author Share Posted June 24, 2009 You wouldn't be able to do that with arbitrary text, only on certain elements. You could drag an entire div, but not just highlight some text in the div and drag it. Is that what you want to do?Sorry my bad, I have a list of BBcodes what I want to drag from the spot to the text area. So the text will not be any text. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 24, 2009 Share Posted June 24, 2009 You should be able to use a drag and drop library, like Walter Zorn's, and have each draggable item in its own container like a div. After getting it set up with the drag and drop library you'll only need a way to indicate which code was dropped onto the text area, which shouldn't be too difficult.http://www.walterzorn.com/dragdrop/dragdrop_e.htm Link to comment Share on other sites More sharing options...
ckrudelux Posted June 25, 2009 Author Share Posted June 25, 2009 You should be able to use a drag and drop library, like Walter Zorn's, and have each draggable item in its own container like a div. After getting it set up with the drag and drop library you'll only need a way to indicate which code was dropped onto the text area, which shouldn't be too difficult.http://www.walterzorn.com/dragdrop/dragdrop_e.htm I was thinking isn't it easier to make a <a href="b/b">b/b</a> and have some script that disables the link as destination? Link to comment Share on other sites More sharing options...
ckrudelux Posted June 25, 2009 Author Share Posted June 25, 2009 Think I found a solution.<textarea onmouseover="this.focus();this.select();" >BBcode</textarea>but I want it to be like this<p onmouseover="this.focus();this.select();" >BBcode</p>or<span onmouseover="this.focus();this.select();" >BBcode</span> Link to comment Share on other sites More sharing options...
ckrudelux Posted June 26, 2009 Author Share Posted June 26, 2009 Think I found a solution.<textarea onmouseover="this.focus();this.select();" >BBcode</textarea>but I want it to be like this<p onmouseover="this.focus();this.select();" >BBcode</p>or<span onmouseover="this.focus();this.select();" >BBcode</span>If know one understands then changing from textarea to p or span the script don do anything. With other words don't work Link to comment Share on other sites More sharing options...
justsomeguy Posted June 26, 2009 Share Posted June 26, 2009 Why doesn't the script work? Is it looking specifically for a textarea? You haven't posted the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.