Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2003
    Location
    Middle of nowhere
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    on select text -> copy text to clipboard

    how can i make, if user selects text, javascript automatically copy it to clipboard
    Last edited by Jefis; 08-14-2005 at 01:42 AM.

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    375
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For IE only:
    Code:
    <script type="text/javascript">
    document.onselectionchange=function(){document.execCommand("Copy")}
    </script>
    Last edited by jscheuer1; 08-14-2005 at 05:44 AM.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Still a bit rude though - what if I had data in the clipboard that I wanted there? You should at least warn users that this will happen.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •