快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

实用的JS获取当前网页的URL

用javascript获取url网址信息

<script type="text/javascript">
document.write("location.host="+location.host+"<br>");
document.write("location.hostname="+location.hostname+"<br>");
document.write("location.href="+location.href+"<br>");
document.write("location.pathname="+location.pathname+"<br>");
document.write("location.protocol="+location.protocol+"<br>");
</script>

执行 用javascript获取url网址信息 代码效果如下

location.host=www.bnxb.com
location.hostname=www.bnxb.com
location.href=http://www.htmlw.cn/bc/2008/0306/article_1860.html
location.pathname=/bc/2008/0306/article_1860.html

顶(3)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论