Js copy to clipboard js clipboard

Source: Internet
Author: User

Js copy to clipboard js implement drawing function js implement copy to clipboard cut turn copy cut function right-click cut turn copy vb copy to clipboard cut and copy

<SCRIPT language = JavaScript>
Function copy (ob ){
Var obj = findObj (ob); if (obj ){
Obj.select({%js%obj.createtextrange(%%%js.exe cCommand ("Copy ");}
}
Function cut (ob ){
Var obj = findObj (ob); if (obj ){
Obj.select({%js%obj.createtextrange(%%%js.exe cCommand ("Cut ");}
}
Function findObj (n, d) {file: // v4.0
Var p, I, x; if (! D) d = document; if (p = n. indexOf ("? ")> 0 & parent. frames. length ){
D=parent.frames[n.substring(p%1%].doc ument; n = n. substring (0, p );}
If (! (X = d [n]) & d. all) x = d. all [n]; for (I = 0 ;! X & I <d. forms. length; I ++) x = d. forms [I] [n];
For (I = 0 ;! X & d. layers & I <d. layers. length; I ++) xforwarfindobj(n,d.layers+ I }.doc ument );
If (! X & document. getElementById) x = document. getElementById (n); return x;
}
File: // -->
</SCRIPT>
<Input type = "button" name = "Button" value = "copy to clipboard" onClick = copy ('txtoutput')>
<Input type = "button" name = "Button" value = "Clipboard" onClick = cut ('txtoutput')>
<Br> <form name = "fom1" method = "post" action = "">
<Textarea name = "txtOutput" rows = "5" cols = "50"> button copy and cut: Use a button to copy and cut, when the left and right keys are displayed, the function is very significant. </Textarea>
</Form>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.