objek pelayarLOGIN

objek pelayar

objek navigator

  • appName: nama perisian penyemak imbas, terutamanya digunakan untuk menentukan penyemak imbas teras yang digunakan oleh pelanggan.

Jika ia adalah pelayar IE, nilai pulangan ialah: Microsoft Internet Explorer

Jika ia adalah pelayar Firefox, nilai pulangannya ialah: Netscape

  • appVersion: Nombor versi teras perisian penyemak imbas.

  • systemLanguage: bahasa sistem

  • userLanguage: user language

  • platform: platform

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script type="text/javascript">
            //实例:测试不同浏览器
            var str = "<h2>浏览器的相关信息</h2>";
            str += "软件名称:"+navigator.appName;
            str += "<br>核心版本:"+navigator.appVersion;
            str += "<br>系统语言:"+navigator.systemLanguage;
            str += "<br>用户语言:"+navigator.userLanguage;
            str += "<br>用户平台:"+navigator.platform;
            document.write(str+"<hr>");
            var width;
            var height;
            if(navigator.appName=="Netscape")
            {
                width = window.innerWidth;
                height = window.innerHeight;
            }else
            {
                width = document.documentElement.clientWidth;
                height = document.documentElement.clientHeight;
            }
            document.write("浏览器内宽:"+width+",浏览器内高:"+height);
        </script>
    </head>
    <body >
    </body>
</html>


bahagian seterusnya
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script type="text/javascript"> //实例:测试不同浏览器 var str = "<h2>浏览器的相关信息</h2>"; str += "软件名称:"+navigator.appName; str += "<br>核心版本:"+navigator.appVersion; str += "<br>系统语言:"+navigator.systemLanguage; str += "<br>用户语言:"+navigator.userLanguage; str += "<br>用户平台:"+navigator.platform; document.write(str+"<hr>"); var width; var height; if(navigator.appName=="Netscape") { width = window.innerWidth; height = window.innerHeight; }else { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } document.write("浏览器内宽:"+width+",浏览器内高:"+height); </script> </head> <body > </body> </html>
babperisian kursus