window属性学习

<!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();" />
 </body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值