BOM学习实用路线(3)——BOM之location对象

location 对象



  • hostname
  • port
  • protocol
  • href
  • hash
    • hashChange
  • search
  • reload()
  • replace()

location 地址: 地址栏相关的信息

console.log(location);

host: “127.0.0.1” 主机信息 域名 + 端口  如:127.0.0.1:8080
hostname: “localhost” 主机地址 || 域名
href 完整的地址
port: 端口
pathname: 路径  (当前网页在服务器中具体路径)
protocol: “http”||“https”   <协议>(基本就有这两种网络协议,大部分是http,有些追求安全性用https)
hash 代表了 # 后边跟随的是hash 关于hash后面会详述
在这里插入图片描述

method:GET/POST/ (具体后面章节再讨论)

<form action="https://www.baidu.com/s" method="GET">
    <input type="search" name="wd" />
    <input type="submit" />
</form>    

search 代表了 ?后边跟随的内容<上图表单提交的数据>, ?wd=CSDN
注意: (get方式提交过来的数据在地址栏中呈现)(post方式提交的数据无法在地址栏中呈现)
在这里插入图片描述

<form action="https://www.baidu.com/s" method="GET">
    <input type="search" name="wd" />
    <input type="search" name="xiao" />
    <input type="search" name="di" />
    <input type="submit" />
</form>    

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述




(后续待补充)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值