zoukankan      html  css  js  c++  java
  • BOM操作

    BOM操作可以获得游览器的页面大小(viewport 视口:不包括工具栏和滚动条)
           (1)ChromefirefoxsafariIE
            var h =window.innerHeight;
            var w = window.innerWidth;
            console.log(h);
            console.log(w);
            (2)IE 8.7.6.5
            document.documentElement.clientHeight;
             document.documentElement.clientWidth;
             或
             document.body.clientWidth;
             document.body.clientHeight;
     
            适配所有的游览器写法
            var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
            var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
     
     
             -------------window的一些方法-----------
            开启一个新的窗口
            var newwindow = window.open();
            console.log(newwindow);
            newwindow.document.write("hahha");
     
            关闭窗口
             window.close();
     
           设备的 分辨率
            document.write("宽度"+window.screen.availWidth);
            document.write("高度"+window.screen.availHeight);
     
     
         web 主机域名   
          document.write(location.hostname);
          当前网页的存放路径
          document.write(location.pathname);
          使用的协议  file/http: https/
          document.write(location.protocol);
     
            function jiazai() {
            var newWindow = window.open();
            加载一个新的页面  assign 分配
            newWindow.location.assign("http://www.baidu.com");
        }
     
     
            获得 游览器的属性 
            document.write("游览器的名称:"+navigator.appName+"<br>");
            document.write("浏览器版本:"+navigator.appVersion+"<br>");
            document.write("硬件平台:"+navigator.platform+"<br>");
            document.write("用户代理语言:"+navigator.systemLanguage+"<br>");
    -------------HISTORY-----------
    input type="button" value ="back" onclick="goBack()">
        <input type="button" value ="forward" onclick="goForward()">
        <a href="http://www.baidu.com">aaa</a>
        <script>
            function goBack() {
                //前一个
                window.history.back();
            }
     
            function goForward() {
                //下一个
                window.history.forward();
            }
  • 相关阅读:
    Python排列函数:sort、sorted
    Python高阶函数:map、reduece、filter
    Python:容器、迭代对象、迭代器、生成器及yield关键字
    JPA-映射-(@OneToOne)双向一对一
    JPA-映射-(@OneToMany、@ManyToOne)双向一对多
    JPA-映射-(@OneToMany)单向一对多
    JPA-映射-(@ManyToOne)单向多对一
    JPA-EntityManager.merge()
    JPA-API
    leetcode 2.Add Two Numbers
  • 原文地址:https://www.cnblogs.com/cntt/p/6479604.html
Copyright © 2011-2022 走看看