属性

说明

window.location.href

完整的url

window.location.protocol

协议

window.location.hostname

主机名

window.location.host

主机名+端口号

window.location.port

端口号

window.location.pathname

当前URL的路径部分

var href  =  window.location.href;//完整的url
var protocol  =  window.location.protocol;//协议
var hostname  =  window.location.hostname;//主机名
var host  =  window.location.host;//主机名+端口号
var port = window.location.port;//端口号
var pathname = window.location.pathname;//当前URL的路径部分
var search = window.location.search;//路径的查询部分
var hash = window.location.hash;//开始的锚点

结果

window.location下的属性说明的更多相关文章

  1. window.location的方法属性详解

    示例URL:http://b.a.com:88/index.php?name=kang&when=2011#first 属性 含义 值 protocol: 协议 "http:&quo ...

  2. location下的属性集锦

    location.protocol="http:"//即,协议 location.hostname="zhidao.baidu.com"//即,主机域名

  3. window.location.hash在firefox下中文自动转码为UTF-8问题

    1.window.location.hash window.location.hash这个属性主要是读取和写入网页位置的,我们经常会用来控制网页单页面跳转或者是控制网页位置.然而这个属性在firefo ...

  4. JS代码的window.location属性详解

    转载:http://www.5icool.org/a/201105/a564.html 如果你稍微懂一些JS代码,一般都会知道 window.location.href 这个属性.并且用该属性获取页面 ...

  5. window.location.hash 使用说明

    本文给大家详细汇总了关于window.location.hash的知识点,属性以及用法等等,非常的实用,并附上了例子,有需要的小伙伴可以参考下.   location是javascript里边管理地址 ...

  6. BOM下的属性和方法---上

    -------------BOM------------------------------------------------ 三个系统对话框   浏览器可以通过alert().confirm()和 ...

  7. window.location.hash 使用

    [转]http://www.cnblogs.com/nifengs/p/5104763.html location是javascript里边管理地址栏的内置对象,比如location.href就管理页 ...

  8. js中的 window.location、document.location、document.URL 对像的区别(转载)

    原文:http://www.cr173.com/html/18417_1.html 当我们需要对html网页进行转向的时候或是读取当前网页的时候可以用到下面三个对像: window.location. ...

  9. window.location详解

    window.location对象常用属性 location.hostname 返回 web 主机的域名 location.host 返回 web 主机的域名(包含端口) location.pathn ...

随机推荐

  1. 快速过滤出完整的SQL语句

    [root@bass ca]# mysqlbinlog -- |egrep -v "^(/|SET|BEGIN|COMMITER|#|COMMIT)" >a.log [roo ...

  2. 一款基于jQuery带事件记录的日历插件

    之前我们也已经分享过不少jQuery日历插件,有些应用了CSS3的特性,外观就特别漂亮.今天要分享的这款jQuery日历插件不仅有着绚丽的外观,而且带有日期事件记录功能,点击日期即可展开事件记录窗口, ...

  3. lua错误收集

    这里放一些我遇到的lua错误,希望大家分享一些错误给我,统一放在这里. 1.lua表的引用传值 上面的代码运行后会发现t2[2],t2[3]表里的内容也被删除了,实际上它们 与t2[1]表里的内容都是 ...

  4. 在ubuntu下安装sourceinsight

    执行更新与安装 wine: # sudo apt-get update # sudo apt-get install wine 下载SourceInsight,用wine来安装: 执行:wine so ...

  5. 亿级Web系统的容错性建设实践(转)

    三年多前,我在腾讯负责的活动运营系统,因为业务流量规模的数倍增长,系统出现了各种各样的异常,那个时候,我7*24小时地没日没夜处理告警,周末和凌晨也经常上线,疲于奔命.后来,当时的老领导对我说:你不能 ...

  6. 几种在Linux下查询外网IP的办法。

    几种在Linux下查询外网IP的办法.   Curl 纯文本格式输出: curl icanhazip.com curl ifconfig.me curl curlmyip.com curl ip.ap ...

  7. 服务器操作系统应该选择 Debian/Ubuntu 还是 CentOS?

    早期,我们使用 Debian 作为服务器软件,后来转向了CentOS,主要原因如下: 1.CentOS/RHEL的生命周期是7年,基本上可以覆盖硬件的生命周期,也就意味着一个新硬件安装以后,不用再次安 ...

  8. nginx的root alias 指令

    location /img/ { alias /var/www/image/; } #若按照上述配置的话,则访问/img/目录里面的文件时,ningx会自动去/var/www/image/目录找文件 ...

  9. 得到application

    ServletContext application = request.getSession().getServletContext();        String basePath = (Str ...

  10. 邂逅明下(巴什博弈+hdu2897)

    H - 邂逅明下 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Sta ...