• javascript 客户端时区、语言的获取


    <script type="text/javascript">

     var d, tz, s = "";
     d = new Date();
     tz = d.getTimezoneOffset();
     tz = tz*(-1);
     
     if(tz < 0) {
     s = s + 'GMT-';
     tz = tz * (-1);
     }
     else s = s + 'GMT+';
       
     if(tz >= 0) {
     var hour = Math.floor(tz/60);
     
     var minute = tz - Math.floor(tz/60) * 60;
     if(hour < 10) s = s + "0" + hour;
     else s = s + hour;
     s = s + ':';
     if(minute < 10) s = s + "0" + minute;
     else s = s + minute;
     
     alert(s);
     alert('window.navigator.userLanguage:' + window.navigator.userLanguage);
     alert('window.navigator.systemLanguage:' + window.navigator.systemLanguage);
     alert('window.navigator.browserLanguage :' + window.navigator.browserLanguage );
     var language = window.navigator.language;
     alert('window.navigator.language:' + window.navigator.language);
     if(!language){
        language = window.navigator.browserLanguage;
        alert('firefox window.navigator.browserLanguage:' + window.navigator.browserLanguage);
      }
    }

     </script>

  • 相关阅读:
    BZOJ 4710: [Jsoi2011]分特产
    P4859 已经没有什么好害怕的了
    BZOJ 2839 集合计数
    P1450 [HAOI2008]硬币购物
    P3440 [POI2006]SZK-Schools
    P4177 [CEOI2008]order
    对于最小割的进一步理解
    P2774 方格取数问题
    JAVA网络编程TCP通信
    JAVA多线程及补充
  • 原文地址:https://www.cnblogs.com/fery/p/1809588.html
Copyright © 2020-2023  润新知