代碼一
<script>
function selecturl(){
z=document
body
createTextRange();
z
moveToElementText(selecturlDiv);
z
select();
}
</script>
<span onmousemove=
selecturl()
id=selecturlDiv><script>document
write(location
href)</script>
代碼二
<script>
function copyCode(o){o
select();var js=o
createTextRange();js
execCommand(
Copy
);alert(
復制成功!
);}
document
write(
<table align=center class=tableborder
cellpadding=
cellspacing=
><tr>
);
document
write(
<td width=
% nowrap class=tablebody
>本頁URL地址(雙擊復制)
</td>
);
document
write(
<td class=tablebody
><textarea onfocus=this
select() style=
width:
%;overflow
y:visible;
ondblclick=copyCode(this) rows=
>
);
document
write(self
location+
</textarea></td></tr></table>
);
</script>
代碼三
<script language=
javascript
>
<!
function copyToClipBoard(){
var clipBoardContent=document
location;
clipBoardContent+=
rn
;
window
clipboardData
setData(
Text
clipBoardContent);
alert(
耶!復制成功喽!你可以粘貼在QQ消息裡送給你的好朋友呀!再次感謝你對 {TheBlogTitle} 的支持哦!
);
}
//
>
</script>
<script language=
javascript
>
document
write(
<img src=
templates/{TemplateName}/images/db
gif
width=
height=
>
);
document
write(
<input size=
value=
+document
location+
><input type=
button
value=
推薦給朋友
title=
點擊復制地址到剪貼板
直接在MSN/QQ上粘貼即可
onclick=
copyToClipBoard()
>
);
</script>
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25348.html