JS获取复制本页地址

 
<input type="button" name="Submit2" onClick='copyToClipBoard()' value="点击复制本文地址">

<script language="javascript">
    function copyToClipBoard(){
         var clipBoardContent="";
         clipBoardContent+=document.title;
         clipBoardContent+="\n";
         clipBoardContent+=this.location.href; //获取地址
         window.clipboardData.setData("Text",clipBoardContent);
         alert("复制成功");
    }
    document.write( this.location.href); //显示地址
</script>
 
展开阅读全文

没有更多推荐了,返回首页