js 判断浏览器使用的语言示例代码

2014-03-22 9

<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>
展开阅读全文

更多Javascript文章

extjs3 combobox取value和text案例详解
Feb 06 8
使用JavaScript 实现各种跨域的方法
May 08 10
jQuery点击自身以外地方关闭弹出层的简单实例
Dec 24 5
js跨域资源共享 基础篇
Jul 02 7
如何使node也支持从url加载一个module详解
Jun 05 7
JS 封装父页面子页面交互接口的实例代码
Jun 25 4
javascript实现图片轮换动作方法
Aug 07 5
手机访问当前页面