Mobile-side replication, PC-side replication

Source: Internet
Author: User

Mobile phone side belongs to the advanced browser-native JS replication is also supported mobile-side replication.

First, click the code to copy the contents of the text box (1)

<script type= "Text/javascript" >
function Jscopy () {
var E=document.getelementbyid ("content");//object is content
E.select (); Select Object
Document.execcommand ("Copy"); Perform a browser copy command

Alert (" copied Well, can be glued. ");
}
</script>
<textarea cols= "name=" Content "rows=" 2 "id=" Content ">www.qzpcw.com</textarea>
<input Type=button value= " copy " onclick= "Jscopy ()" >

Second, click the code to copy the contents of the text box (2)

<script language=javascript>
<!--
function Mm_gotourl () {//v3.0
var i, args=mm_gotourl.arguments; Document. Mm_returnvalue = false;
for (i=0; i< (args.length-1); i+=2) eval (args[i]+ ". location= '" +args[i+1]+ "'");
}
function JM_CC (ob) {
var obj=mm_findobj (OB); if (obj) {
Obj.select (); Js=obj.createtextrange (); Js.execcommand ("Copy");}
}
function Mm_findobj (n, D) {//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)].document; 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++) X=mm_findobj (n,d.layers[i].document);
if (!x && document.getElementById) X=document.getelementbyid (n); return x;
}
-
</SCRIPT>
<form action= "" Method=post name=form1>
<textarea cols=60 name=js_1 rows=2 wrap=virtual>www.qzpcw.com</textarea>
</form>
<input Name=button onclick= "jm_cc (' Js_1 ')" Type=button value=Copy>

Third, click the code to copy the contents of the text box (3)

<script>
function Ocopy (obj) {
Obj.select ();
Js=obj.createtextrange ();
Js.execcommand ("Copy")
}
</script>
<input onclick= "ocopy (This)" value=www.qzpcw.com>

Iv. Click the code to copy the title and address

<title>www.qzpcw.com</title>
<input type= "button" Name= "Submit" onclick= ' CopyToClipboard () ' value= ' copy The address of this page to friends on Qq/msn >
<script language= "JavaScript" >
function CopyToClipboard () {
var clipboardcontent= "";
Clipboardcontent+=document.title;
clipboardcontent+= "";
Clipboardcontent+=this.location.href;
Window.clipboardData.setData ("Text", clipboardcontent);
Alert (" copy successful, please paste to your qq/msn on your friend");
}
</script>

Click the code to copy the URL

<script type= "Text/javascript" >
function CopyText (obj)
{
var rng = Document.body.createTextRange ();
Rng.movetoelementtext (obj);
Rng.scrollintoview ();
Rng.select ();
Rng.execcommand ("Copy");
Rng.collapse (FALSE);

Alert (" copy is successful, please paste it to your friend on your qq/msn.")   "); <!--this sentence to add, optional--

}
</script>
Here is the code snippet:<br>
<span id= "Tbid" >http://www.qzpcw.com</span>
[<a href= "#" onclick= "CopyText (document.all.tbid)" > Click Copy </a>]<br>
<span id= "Tbid1" >http://www.qzpcw.com</span>
[<a href= "#" onclick= "CopyText (DOCUMENT.ALL.TBID1)" > Click Copy </a>]<br>

Front-end AC Group: Group name:html5/css3/js/jq/nodejs/div Group number:339840649

Mobile-side replication, PC-side replication

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.