求一段显示当前页URL的javascript脚本

来源:百度知道 编辑:UC知道 时间:2024/06/05 14:50:15
用任何内容创建页面,但是要求在页面载入后自动弹出一个对话框,显示当前页的URL

<table width=100% cellpadding=0 cellspacing=0 border=0 >
<script>
thisURL = document.URL;
strwrite = "<tr><td valign=top>thisURL: </td><td>[" + thisURL + "]</td></tr>"
document.write( strwrite );
</script>
<script>
tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];
strwrite = "<tr><td valign=top>thisHPage: </td><td>[" + thisHPage + "]</td></tr>"
strwrite += "<tr><td valign=top>thisUPage: </td><td>[" + thisUPage + "]</td></tr>"
document.write( strwrite );
</script><tr><td>