Connecting Tech Pros Worldwide Forums | Help | Site Map

a small problems with Select and Auto Copy

Koman \( Hong Kong \)
Guest
 
Posts: n/a
#1: Jul 23 '05
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("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("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
Guest
 
Posts: n/a
#2: Jul 23 '05

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..."

http://www.krikkit.net/howto_javascr...clipboard.html

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

Mike
Closed Thread


Similar JavaScript / Ajax / DHTML bytes