zoukankan      html  css  js  c++  java
  • 7月15日:BOM总结

    BOM(浏览器对象模型)是JS实现的一部分,没有任何相关的标准。
    一、Window对象

      a.窗口操作:
        1. moveBy(IE) 相对移动
          window.moveBy(100,100);
        2. moveTO (IE) 以屏幕左上角为原点进行移动
          window.moveTo(100, 100);
        3. resizeBy(IE) 原型上增减宽高
          window.resizeBy(300, 300);
        4. resizeTo 修改宽高的指定值
          window.resizeTo(300, 300);
        5. screenLeft/Top(IE) 查看窗口距离屏幕左边和顶部的距离
          alert(window.screenLeft/Top);
        6. screenx/y(Mozilla) 查看窗口位置
          alert(window.screenX/Y);
        7. innerWidth/Height 查看客户区宽高
          alert(window.innerWidth/Height);
        8. outerWidth/Height 查看窗口宽高
          alert(window.outerWidth/Height);

      b.窗口的打开关闭
        1. open("url","名称","属性") 在新窗口中打开
          window.open("page2.html", "", "width=400px, height=400px");
        2. close 关闭副窗口

      c.系统对话框
        1. alert (字符串)
        2. confirm 选择是(true)或否(false)
          if(confirm("是否提交")) {
            alert("提交成功!");
          } else {
            alert("提交失败!");
          }
        3. prompt("input","默认值") OK返回输入值,取消返回null

      d.状态栏
        通过defaultStatus或status设置,defaultStatus优先级大于status

      e.时间间隔和暂停
        1. setTimeout() 延迟 clearTimeout 清除延迟;执行一次
          var str = (123);
          var t = window.setTimeout("alert(str)",2000);
          window.clearTimeout(t);
        2. setInterval/clearIterval 可多次执行延迟

      f.历史
        1. windou.history.forward/back 前进或后退历史页面
          btn1.onclick = function() {
            window.history.forward();
          };
          btn2.onclick = function() {
            window.history.back();
          };
      2. window.history.go(+/-n) 当n>0,前进到第n个页面;当n<0,后退到第n个页面
      3. window.history.length() 查看历史页面个数

    二、document对象

      1. document.lastModified 查看最后修改时间
       document.referrer 查看后退一个页面的url
       document.title 查看标题
       document.URL 查看当前页面的url
      2. anchors 锚点合集
        document.anchors.length
       forms 表单合集
       images 图片合集
       links 超链接合集
      3. document.write 向文档写入数据
       document.writeln 向文档写入数据,并已空格隔开
        document.write(123);
        document.write(123);
        document.writeln(123);
        document.writeln(123);
        document.writeln(123);

    三、location 对象

      1.href();assign();replace() 都可以用来跳转网页,但replace()方法不会产生历史信息

      2.reload() 重新载入当前页面;值为ture时,从服务器刷新,上传数据;值为false时,本地刷 新,不上传数据


    四、navigator 对象:关于浏览器本身的信息

      1.appCodeName 浏览器代码名的字符串表示

      2.appVersion 浏览器版本信息的字符串表示

    五、screen 对象

      1.availHeight/Width 窗口可使用的屏幕高度/宽度

      2.height/width 屏幕的高度/宽度

      3.全屏设置(IE)
        window.moveTo(0,0);
        window.resizeTo(screen.availWidth,screen.availHeight);

  • 相关阅读:
    c++ 反汇编 除法优化
    python3 循环位移动
    Reverse 高校网络信息安全运维挑战赛
    2019_西湖论剑_预选赛 testre
    《C++反汇编与逆向分析技术揭秘》--算术运算和赋值
    《C++反汇编与逆向分析技术揭秘》--认识启动函数,找到用户入口
    《C++反汇编与逆向分析技术揭秘》--数据类型
    D8016 “/ZI”和“/Gy-”命令行选项不兼容
    逆向学习书籍分享
    获得PyInstaller打包exe的py源码
  • 原文地址:https://www.cnblogs.com/f19huangtao/p/4649586.html
Copyright © 2011-2022 走看看