属性

说明

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. 每日英语:Is Bedtime Snacking Bad?

    It's a familiar scenario in many households: Hours after dinner, the stomach growls and the refriger ...

  2. python爬虫解析库之re模块

    re模块 一:什么是正则? 正则就是用一些具有特殊含义的符号组合到一起(称为正则表达式)来描述字符或者字符串的方法.或者说:正则就是用来描述一类事物的规则.(在Python中)它内嵌在Python中, ...

  3. Django REST framework 知识点总结

    一.安装DjangoREST framework #先安装Django #安装必要的包 pip install djangorestframework coreapi (1.32.0+) - Sche ...

  4. linux查看匹配内容的前后几行(转)

    linux系统中,利用grep打印匹配的上下几行   如果在只是想匹配模式的上下几行,grep可以实现.   $grep -5 'parttern' inputfile //打印匹配行的前后5行   ...

  5. python学习笔记(2)--sublimeText3运行python

    https://www.zhihu.com/question/22904994 知乎用户 To the knowledge 74 人赞同 如果是想在sublime里要python shell那种交互或 ...

  6. Adroid—— DVM

     Android DVM   Android 运行环境主要指的虚拟机技术——Dalvik.Android中的所有Java程序都是运行在Dalvik VM上的.Android上的每个程序都有自己的线程, ...

  7. oozie4.3.0+sqoop1.4.6实现mysql到hive的增量抽取

    1.准备数据源 mysql中表bigdata,数据如下: 2. 准备目标表 目标表存放hive中数据库dw_stg表bigdata 保存路径为 hdfs://localhost:9000/user/h ...

  8. 解决request.getRemoteAddr()获取的值为0:0:0:0:0:0:0:1这个小问题

    症状: Windows操作系统,eclipse开发环境下,在本机上使用http://localhost:8080/...访问本机上的页面,使用tomcat作为服务器 在Servlet或者Action中 ...

  9. JQueryEasyUI-DataGrid显示数据,条件查询,排序及分页

    <html><head>    <title></title>    <script src="/jquery-easyui-1.3.4 ...

  10. [android] AndroidManifest.xml【 manifest -> permission-tree 和 manifest -> permission-group】

    permission-tree 权限树 <permission-tree android:icon="drawable resource" android:label=&qu ...