DOM Location 对象

Location 对象

The Location object is an object that can be accessed through the location property of the Window object.
Location对象可通过window对象的location属性访问到。

The Location object contains information about the current URL.
Location对象包含了当前URL的信息

举例: 将用户传送到新的地方/URL

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Location 对象属性

Property
属性
Description
描述
IEFNW3C
hashSets or returns the part of the href property that follows the hash sign (#)
设置或返回href属性中在#符号后面的内容
312 
hostSets or returns the hostname and port number of the location or URL
设置或返回URL或本地所在的域名以及端口号
312 
hostnameSets or returns the hostname of the location or URL
设置或返回本地或是URL所在的域名
312 
hrefSets or returns the entire URL
设置或返回完整的URL
312 
pathnameSets or returns the file name or path specified by the location object
设置或返回由location对象指定的file名称或是路径
312 
portSets or returns the port number associated with the URL
设置或返与URL有关的端口号
312 
protocolSets or returns the protocol part of the URL
设置或返回URL部分所使用的协议
312 
searchSets or returns the part of the href property that follows the question mark (?)
设置或返回href属性里?号之后的内容
312 

Location 对象方法

Method
方法
Description
描述
IEFNW3C
assign("URL")Loads a new document
加载新的文档
412 
reload()Reloads the current document
重新载入当前文档
412 
replace("URL")Replaces the current document with the one specified
用一指定的文档来替换当前的文档
413 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值