日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > HTML >内容正文

HTML

js获取浏览器语言(ie、ff、chrome)、contextpath

發(fā)布時(shí)間:2023/12/20 HTML 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 js获取浏览器语言(ie、ff、chrome)、contextpath 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
js獲取瀏覽器語(yǔ)言(ie、ff、chrome)、contextpath

/js獲取瀏覽器語(yǔ)言(ie、ff、chrome)?

Java代碼??
  • var?language_en_us?=?"en-us";??
  • var?language_zh_cn?=?"zh-cn";??
  • var?currentLang;??
  • var?en_lang?=?{?'test.name':?"name",'test.age':?"age"};??
  • var?zh_lang?=?{?'test.name'':?"名字",'test.age'':?"年齡"};??
  • var?current_lang_map;??
  • ??
  • currentLang?=?navigator.language;??
  • if(!currentLang)??
  • ????currentLang?=?navigator.browserLanguage;??
  • if(currentLang.toLowerCase()?==?language_zh_CN)??
  • {??
  • ????current_lang_map?=?zh_lang;???????
  • }??
  • else??
  • {??
  • ????current_lang_map?=?en_lang;??
  • }??
  • ??
  • dirstr?+=?"<div?id=age'?class='age'>"?+current_lang_map['test.name']+":8"+"</div>";??


  • js獲取上下文路徑(contextPath)?

    Java代碼??
  • //獲取contextpath??
  • function?getContextPath()?{??
  • ??var?pathName?=?document.location.pathname;??
  • ??var?index?=?pathName.substr(1).indexOf("/");??
  • ??var?result?=?pathName.substr(0,index+1);??
  • ??return?result;??
  • } ?
  • posted on 2016-12-07 10:48 玲兒靈 閱讀(...) 評(píng)論(...) 編輯 收藏

    轉(zhuǎn)載于:https://www.cnblogs.com/jymz/p/6140273.html

    總結(jié)

    以上是生活随笔為你收集整理的js获取浏览器语言(ie、ff、chrome)、contextpath的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。