063|location对象的属性

在这里插入图片描述
类似的:
在这里插入图片描述
在这里插入图片描述

location对象的属性

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>location</title>
		<script>
			/*
			  url:统一资源定位符
			  完成的url:
			  中文版本 协议//主机名:端口号/路径?查询的字符窜#锚点
			  英文版本 protocol://hostname:port/pathname/?search#hash
			  
			 ① location.protocal:
			  1.file:本地磁盘文件访问
			  2.http:
			  3.https:(证书认证协议)
			   
			 
			  ②location.hostname 主机名: IP(在全球范围内找到你当前网络的地址)
			  IP难记有4块,用域名就是IP的别称(像www.baidu.com)
			  
			  ③location.port 端口号(默认是隐藏的)
			  【注】是当前电脑中使用网络的软件,随机给他分配一个编号 0~65535
			  
			  hostname:port 可以直接定位到当前使用网络的程序
			  小细节:浏览器 8080
			          http  80
					   https 443
			  
			  ④location.pathname 路径
			  
			  ⑤location.search 查询字符窜(前后端交互)
			  ?name1=value1&name2=value2
			  
			  ⑥location.hash  锚点 #
			  
			  
			*/
		   alert(location.protocol);//http:
		   alert(location.hostname);//127.0.0.1
		   alert(location.pathname);///javascript/63location%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%B1%9E%E6%80%A7.html
		   alert(location.search);//?name1=value1&name2=value2
			alert(location.hash);//#1
			 
			 alert(location);//object对象http://127.0.0.1:8848/javascript/63location%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%B1%9E%E6%80%A7.html
			 alert(location.href);//整个url string类型http://127.0.0.1:8848/javascript/63location%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%B1%9E%E6%80%A7.html
			
		</script>
	</head>
	<body>
	</body>
</html>

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

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

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值