a small problems with Select and Auto Copy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Koman \( Hong Kong \)

    #1

    a small problems with Select and Auto Copy

    Dear Experts,

    I want to capture the text to the clipbroad when i use the mouse left
    clicking on such text..
    ( i want to simplify the step of "Highlight Text" > "Mouse Right Click" >
    "Copy")
    Can i use javascript to do this?

    I found some hints about this from internet:
    =============== =============== =============== =
    <!-- Begin
    function copyit(theField ) {
    var tempval=eval("d ocument."+theFi eld)
    tempval.focus()
    tempval.select( )
    therange=tempva l.createTextRan ge()
    therange.execCo mmand("Copy")
    }
    // End -->
    </script>

    </HEAD>
    <BODY>

    <form name="it">
    <div align="center">
    <input onclick="copyit ('it.select1')" type="button" value="Press to Copy the
    Text" name="cpy">
    <p>
    <textarea name="select1" rows="3" cols="25">
    If this is highlighted, then it has been copied.
    </textarea>
    </div>
    </form>
    =============== =============== =======
    But this text needs inside the text box..
    How can i do this?
    Thans so much~

    Koman Ko


  • mscir

    #2
    Re: a small problems with Select and Auto Copy

    Koman ( Hong Kong ) wrote:[color=blue]
    > Dear Experts,
    >
    > I want to capture the text to the clipbroad when i use the mouse left
    > clicking on such text..[/color]
    <snip>

    This code will copy text to the clipboard, works on my IE6, Netscape
    7.2, Firefox 1PR, MOZ 1.7.3.

    "this script only works in mozilla if you sign the javascript or if you
    change some settings in mozilla... see notes below..."



    If you have trouble selecting just the text you want, post the code
    you're using.

    Mike

    Comment

    Working...