日期:2009-07-08  浏览次数:21074 次

内建Behavior的应用:Clientcaps篇
"clientcaps"提供系统的相关信息,可以套用到网页中的任何一个元件。
XMLlover.htm

<HTML>
<head>
    <title>XMLlover</titie>
    <style>
    input {behavior:url(#default#clientcaps)}
    //内建Behavior的套用语法
    </style>
    
    <script language="vbscript">
    function button1_onclick()
        str1=button1.colordepth
        str2=button1.connectiontype
        str3=button1.cpuclass
        str4=button1.height
        str5=button1.width
        str6=button1.platform
        str7=button1.systemlanguage
        str8=button1.userlangauge
        document.open
        document.write "<pre style='font-size:18'>"
        document.writeln "colordepth=" & str1
        document.writeln "connectiontype=" & str2
        ...............
        docuemnt.writeln "userlanguage=" & str8
        document.write "</pre>"
    end function
    </script>
    </head>
    
    <body>
    <input type="button" id="button1" value="click me">
    </body>
</HTML>
"clientcaps"有一个内建的方法,叫做"GetComponentVserion",可以传回浏览器
的版本信息,功能类似于"HMTL"的"navigator.appversion"指令。在此就不再述说了