DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> js 判斷浏覽器使用的語言示例代碼
js 判斷浏覽器使用的語言示例代碼
編輯:JavaScript綜合知識     

 這篇文章主要介紹了使用js 判斷浏覽器使用的語言,需要的朋友可以參考下

代碼如下: <script type="text/javascript">  var language = navigator.browserLanguage?navigator.browserLanguage:navigator.language;  alert(language);  if (language.indexOf('en') > -1) document.location.href = 'english.htm';  else if (language.indexOf('nl') > -1) document.location.href = 'dutch.htm';  else if (language.indexOf('fr') > -1) document.location.href = 'french.htm';  else if (language.indexOf('de') > -1) document.location.href = 'german.htm';  else if (language.indexOf('ja') > -1) document.location.href = 'japanese.htm';  else if (language.indexOf('it') > -1) document.location.href = 'italian.htm';  else if (language.indexOf('pt') > -1) document.location.href = 'portuguese.htm';  else if (language.indexOf('es') > -1) document.location.href = 'Spanish.htm';  else if (language.indexOf('sv') > -1) document.location.href = 'swedish.htm';  else if (language.indexOf('zh') > -1) document.location.href = 'chinese.htm';  else  document.location.href = 'english.htm';  </script>     
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved