一、Location对象

    1.location对象:window.location对象用于获取当前页面的地址(URL),并把浏览器重定向到新的页面。

    2.location对象的属性:

      location.hostname返回web主机的域名

      location.pathname返回当前页面的路径和文件名

      location.port返回web主机的端口

      location.protocol返回所使用的web协议(http://或https://)

      location.href属性返回当前页面的url

      location.assign()方法加载新的文档

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<button id="btn" onclick="getLoc()">按钮</button>
		<p id="ptime"></p>
		<script>
			function getLoc(){
//				document.getElementById("ptime").innerHTML = window.location.hostname;
//				document.getElementById("ptime").innerHTML = window.location.pathname;
//				document.getElementById("ptime").innerHTML = window.location.port;
//				document.getElementById("ptime").innerHTML = window.location.href;
				location.assign("http://www.baidu.com");
			}
		</script>
	</body>
</html>


二、Screen对象

    1.Screen对象:

      window.screen对象包含有关用户屏幕的信息

    2.属性:

      screen.availWidth-可用的屏幕宽度

      screen.availHeight-可用的屏幕高度

      screen.Height-屏幕高度

      screen.Width-屏幕宽度

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<button id="btn" onclick="getLoc()">按钮</button>
		<p id="ptime"></p>
		<script>
			document.write("可用高度:"+screen.availHeight+",可用宽度"+screen.availWidth);
			document.write("高度:"+screen.height+",宽度"+screen.width);
		</script>
	</body>
</html>