<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>window属性学习</title>
<!--
screen属性:获得客户端屏幕信息的。其实screen其实是一个对象
width;height;宽高
availWidth;availHeight;可用宽高
l ocation:地址栏属性
href:地址栏属性
reload刷新
history:历史纪录属性
forward();
back();
go();
navigator:浏览器的版本信息属性
window.navigator.UserAgent获取当前浏览器的版本信息。
-->
<script type="text/javascript">
function testScreen(){
alert(window.screen.width+":"+window.screen.height);
alert(window.screen.availHeight+":"+window.screen.availWidth);
}
//location属性
function testLocation(){
alert(window.location.href);//使用href获取地址栏URL性质
//window.location.href="http://www.taobao.com";
window.location.href="04小示例显示时间.html";
}
//reload属性
function testReload(){
window.localtion.reload();
}
//history属性
function testHistory(){
//window.history.forward();
window.history.go(1);//前进活后退到制定的历史纪录,正整数前进负整数后退,0相当于刷新
}
//navigator
function testNavigator(){
alert(window.navigator.userAgent);
}
</script>
</head>
<body>
<h3>window属性学习</h3>
<input type="button" id="" value="测试screen属性" οnclick="testScreen();" />
<input type="button" id="" value="测试location属性" οnclick="testLocation();" />
<input type="button" id="" value="测试Reload属性" οnclick="testReload();" />
<input type="button" id="" value="测试Navigator" οnclick="testNavigator();" />
<html>
<head>
<meta charset="utf-8">
<title>window属性学习</title>
<!--
screen属性:获得客户端屏幕信息的。其实screen其实是一个对象
width;height;宽高
availWidth;availHeight;可用宽高
l ocation:地址栏属性
href:地址栏属性
reload刷新
history:历史纪录属性
forward();
back();
go();
navigator:浏览器的版本信息属性
window.navigator.UserAgent获取当前浏览器的版本信息。
-->
<script type="text/javascript">
function testScreen(){
alert(window.screen.width+":"+window.screen.height);
alert(window.screen.availHeight+":"+window.screen.availWidth);
}
//location属性
function testLocation(){
alert(window.location.href);//使用href获取地址栏URL性质
//window.location.href="http://www.taobao.com";
window.location.href="04小示例显示时间.html";
}
//reload属性
function testReload(){
window.localtion.reload();
}
//history属性
function testHistory(){
//window.history.forward();
window.history.go(1);//前进活后退到制定的历史纪录,正整数前进负整数后退,0相当于刷新
}
//navigator
function testNavigator(){
alert(window.navigator.userAgent);
}
</script>
</head>
<body>
<h3>window属性学习</h3>
<input type="button" id="" value="测试screen属性" οnclick="testScreen();" />
<input type="button" id="" value="测试location属性" οnclick="testLocation();" />
<input type="button" id="" value="测试Reload属性" οnclick="testReload();" />
<input type="button" id="" value="测试Navigator" οnclick="testNavigator();" />
</body>
</html>
</html>