HTML DOM pathname 属性

定义和用法

pathname 属性是一个可读可写的字符串,可设置或返回当前 URL 的路径部分。

语法

location.pathname=path

实例

假设当前的 URL 是: http://example.com:1234/test/test.htm#part2:

<html>
<body>

<script type="text/javascript">
document.write(location.pathname);
</script>

</body>
</html>

输出:

/test/test.htm
系统帮助 | 给我留言 | 收藏本站
Copyright © 2005-2008 www.cnn84.com All Rights Reserved Ver:2.0
CNN84网是公益性便民网站,是为了给大家的日常生活查询及提供最快捷的出行指南