<script type="text/javascript">
window.onload=function(){
$('#url').attr('value',window.location.href);
}
function copyUrl() {
var url = document.getElementById("url").value;
window.clipboardData.setData("Text", url);
}
</script>
<button class="btn"onClick="url.select();document.execCommand('Copy')">分享</button>
<input style="opacity: 0;height: 0px !important;" type="text" size="" id="url" value="">