(function($){
02 //
03 // DIV must be style="display:none;"
04 //
05 $.fn.chk_userlanguage = function() {
06 /* check if <style=display:none;> not set to that element */
07 if (!this.is(":hidden")) { this.hide(); };
08
09 /* get browser default lang */
10 if (navigator.userLanguage) {
11 baseLang = navigator.userLanguage.substring(0,2).toLowerCase();
12 } else {
13 baseLang = navigator.language.substring(0,2).toLowerCase();
14 }
15
16 /* language match */
17 switch(baseLang)
18 {
19 case "de":
20 /* german */
21 this.slideDown("slow");
22 break;
23 case "en":
24 /* english */
25 break;
26 case "ja":
27 /* japanese */
28 break;
29 case "zh":
30 /* 中文 */
31 break;
32 default:
33 /* default no match */
34 }
35 };
36 })(jQuery);
javascript:document.write(navigator.language.substring(0,2).toLowerCase());
javascript:document.write(document.cookie);打印出浏览器的cookie值