<script language="JavaScript">
<!--
document.write('<font color=red>当前网页主题:</font>')
document.write(document.title+'<br><font color=red>网页的路径为:</font>'+document.URL)
//-->
</script>
<!--
document.write('<font color=red>当前网页主题:</font>')
document.write(document.title+'<br><font color=red>网页的路径为:</font>'+document.URL)
//-->
</script>
但遇到框架时,nba23的方法得到的是当前页面(使用document.URL)的url!
meizz的方法得到的是父框架的url.
请看下面示例:
main.htm:
<frameset cols="20%,*">
<frame src="about:blank"></frame>
<frame src="1.htm"></frame>
</frsmeset>
1.htm:
<script language="javascript">
alert(top.location.href);
alert(document.URL);
</script>