JS Current URL Share this article URL code

Source: Internet
Author: User
The code is as follows Copy Code

<script language=javascript>
Start of automatic COPY code
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;

}

function JM_CC (ob) {

var obj=mm_findobj (OB); if (obj) {

Obj.select (); Js=obj.createtextrange (); Js.execcommand ("Copy");}

Alert ("Copy the current URL successfully, please paste it into your qq/msn and recommend it to your friends!") ");

}

Automatic COPY code End

document.write (' <b><font color=red style=font-size:14px> recommended to friends: </font></b><input name= " Page_url "value=" ' +window.location.href+ ' "size=" > <input type= "button" name= "button" class= "Button1" style= color:red value= "Copy current URL" onclick=jm_cc ("Page_url") > ');

</script>

Example Two

  code is as follows copy code

<meta http-equiv= "Content-type" content= "text/html. CHARSET=GBK"

<meta name= "Keywords" Content= "" "/>
<meta name=" Description "content=" "/>
<meta name=" Author "content=" Lession "/>

<script language= "javascript"

<!--  
function copy () {  
    var clipboardcontent= "";  
    clipboardcontent+=this.location.href;  
    window.clipboardData.setData ("Text"), clipboardcontent);  
    alert ("Copy succeeded, paste to your qq/msn" recommended to your buddy);  
}   
//

</script>
  <body >  
URL points Enjoy friends >  
</body>  

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.