熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Javascript >> 正文

獲得本頁面URL地址的三個JS代碼

2013-11-23 17:54:58  來源: Javascript 
代碼一


<script>
function selecturl(){
z=documentbodycreateTextRange();
zmoveToElementText(selecturlDiv);
zselect();
}
</script>
<span onmousemove=selecturl() id=selecturlDiv><script>documentwrite(locationhref)</script>


代碼二

<script>
function copyCode(o){oselect();var js=ocreateTextRange();jsexecCommand(Copy);alert(復制成功!);}
documentwrite(<table align=center class=tableborder cellpadding= cellspacing=><tr>);
documentwrite(<td width=% nowrap class=tablebody>本頁URL地址(雙擊復制)</td>);
documentwrite(<td class=tablebody><textarea onfocus=thisselect() style=width:%;overflowy:visible; ondblclick=copyCode(this) rows=>);
documentwrite(selflocation+</textarea></td></tr></table>);
</script>


代碼三

<script language=javascript>

<!

function copyToClipBoard(){

var clipBoardContent=documentlocation;

clipBoardContent+=rn;

windowclipboardDatasetData(TextclipBoardContent);

alert(耶!復制成功喽!你可以粘貼在QQ消息裡送給你的好朋友呀!再次感謝你對 {TheBlogTitle} 的支持哦!);

}

//>

</script>

<script language=javascript>

documentwrite(<img src=templates/{TemplateName}/images/dbgif width= height=>);

documentwrite(<input size= value=+documentlocation+><input type=button value=推薦給朋友 title=點擊復制地址到剪貼板直接在MSN/QQ上粘貼即可 onclick=copyToClipBoard()>);

</script>
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25348.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.