• BOM


    • document

        forms、images、links

    • location

        href、reload()

    • history

        go(-1)  ==  back()

        go(1)  ==  forward()

    • navigator
    • screen
    • frames
    • open

      alert  confirm  prompt

      setInterval  clearInterval  setTimeout  clearTimeout(用于setTimeout还没执行前调用)

     //取消默认的浏览器自带右键 很重要!!  
    
    window.oncontextmenu=function(e){
      e.preventDefault();
    })



    decodeURIComponent

    encodeURIComponent 

    Screen

    ①. 浏览器宽高(除window的任务栏)

     screen.availWidth,screen.availHeight

    ②.电脑宽高

     screen.width,screen.height


    #获取操作系统名

    function getOS() {
        // 苹果系统
        let isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
        if (isMac) return "Mac";
        // unix系统
        let isUnix = (navigator.platform == "X11") && !isWin && !isMac;
        if (isUnix) return "Unix";
        // Linux系统
        let isLinux = (String(navigator.platform).indexOf("Linux") > -1);
        if (isLinux) return "Linux";
        // window系统
        let sUserAgent = navigator.userAgent;
        let isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
        if (isWin) {
            let isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;
            if (isWin2K) return "Win2000";//win200
            let isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1;
            if (isWinXP) return "WinXP";//winxp
            let isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;
            if (isWin2003) return "Win2003";//win2003
            let isWinVista= sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;
            if (isWinVista) return "WinVista";//winVista
            let isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;
            if (isWin7) return "Win7";//win7
            let isWin10 = sUserAgent.indexOf("Windows NT 10") > -1 || sUserAgent.indexOf("Windows 10") > -1;
            if (isWin10) return "Win10";//win10
        }
        return "other";
    }
    console.log('navigator.platform: ' + navigator.platform);
    console.log('navigator.userAgent: ' + navigator.userAgent);
    console.log("您的操作系统是:" + getOS());
    

    #获取浏览器名 

    function getBrower () {
      let browser = {};
      let userAgent = navigator.userAgent.toLowerCase();
      let s;
      (s = userAgent.match(/msie ([d.]+)/)) ? browser.ie = s[1] : (s = userAgent.match(/firefox/([d.]+)/)) ? browser.firefox = s[1] : (s = userAgent.match(/chrome/([d.]+)/)) ? browser.chrome = s[1] : (s = userAgent.match(/opera.([d.]+)/)) ? browser.opera = s[1] : (s = userAgent.match(/version/([d.]+).*safari/)) ? browser.safari = s[1] : 0;
      let version = "";
      if (browser.ie) {
        version = 'IE ' + browser.ie;
      }
      else {
        if (browser.firefox) {
          version = 'firefox ' + browser.firefox;
        }
        else {
          if (browser.chrome) {
            version = 'chrome ' + browser.chrome;
          }
          else {
            if (browser.opera) {
              version = 'opera ' + browser.opera;
            }
            else {
              if (browser.safari) {
                version = 'safari ' + browser.safari;
              }
              else {
                version = '未知浏览器';
              }
            }
          }
        }
      }
      return version;
    }
    console.log(getBrower());
    

     #获取ip地址

    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
    <script> 
      console.log(returnCitySN["cip"]+','+returnCitySN["cname"]) 
    </script>
    

      

    防止默认行为(表单提交按钮后页面刷新问题)

    e.preventDefault();

     

    1.鼠标事件以及clientX、offsetX、screenX、pageX、x的区别
    https://blog.csdn.net/weixin_41342585/article/details/80659736

    2.touch事件中的touches、targetTouches和changedTouches详解
    https://blog.csdn.net/ranran125/article/details/79747290

      

  • 相关阅读:
    数学建模(一)层次分析法
    数学建模(二)优劣解距离法Topsis模型部分
    python语法学习第十一天--模块
    机器学习——交叉验证,GridSearchCV,岭回归
    机器学习——logistic回归,鸢尾花数据集预测,数据可视化
    机器学习入门——线性回归预测广告投入数据集
    凸优化,对偶问题与拉格朗日函数
    机器学习中的凸优化,凸集,凸函数的相关定义和理论
    调整数组顺序使奇数位于偶数前面
    leetcode| 329. 矩阵中的最长递增路径
  • 原文地址:https://www.cnblogs.com/lgyong/p/8998944.html
Copyright © 2020-2023  润新知