DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> 獲得當前頁面URL地址的三個JS代碼
獲得當前頁面URL地址的三個JS代碼
編輯:關於JavaScript     
碼一:

<script>
function selecturl(){
z=document.body.createTextRange();
z.moveToElementText(selecturlP);
z.select();
}
</script>
<span onmousemove='selecturl()' id=selecturlP><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=tableborder1 cellpadding=1 cellspacing=0><tr>");
document.write("<td width=10% nowrap class=tablebody1>本頁URL地址(雙擊復制):</td>");
document.write("<td class=tablebody1><textarea onfocus=this.select() style='width:100%;overflow-y:visible;' ondblclick=copyCode(this) rows=1>");
document.write(self.location+"</textarea></td></tr></table>");
</script>


代碼三:

<script language="javascript">

<!--

function copyToClipBoard(){

var clipBoardContent=document.location;

clipBoardContent+='\r\n';

window.clipboardData.setData("Text",clipBoardContent);

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

}

//-->

</script>

<script language='javascript'>

document.write("<img src=\"templates/{TemplateName}/images/db.gif\" width=\"49\" height=\"17\">");

document.write("<input size=\"60\" value=\""+document.location+"\"><input type=\"button\" value=\"推薦給朋友\" onclick=\"copyToClipBoard()\">");

</script>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved