Jump to content

Copy


ckrudelux

Recommended Posts

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

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...