获得本页面URL地址的三个JS代码

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

码一:

<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=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=\"推荐给朋友\" title=\"点击复制地址到剪贴板,直接在MSN/QQ上粘贴即可.\" onclick=\"copyToClipBoard()\">");

</script>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航