Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can We Invoke Keyboard Events On Button Press ?  RSS feed

 
Gajendra Tomer
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All !

We have a requirement to copy text from TextArea1 & paste it into TextArea2 with the help of 2 push buttons: "Copy" & "Paste", instead of using "CTRL+C" & "CTRL+V" key combinations.

We have done it in IE 7 & 8 but we are not able to make it done in Mozilla Firefox 3.6 browser.

Please help in this regard.

Thanks in advance.

Gajendra Singh Tomar

 
Tom Varga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because of security restrictions, clipboard access is not always allowed in Firefox (see clipboardData)

A possible solution is to store the selected text in a JavaScript variable on copy and insert its value on paste. The disadvantage of that solution is that the user cannot use CTRL+V to paste the text into TextArea2, because it is not on the clipboard.



Related links:
selectionStart property,
value property (textarea).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!