HBCMS更多的中文手册参考:

clientCaps Behavior

DHTML文档教程

Provides information about features supported by Microsoft® Internet Explorer, as well as a way for installing browser components on demand.

dhtml语法

XML <Prefix: CustomTag ID=sID STYLE="behavior:url('#default#clientcaps')" />
HTML <ELEMENT STYLE="behavior:url('#default#clientCaps')" ID=sID>
Scriptingobject.style.behavior = "url('#default#clientcaps')"
object.addbehavior ("#default#clientcaps")

dhtml可能的值

prefixprefix that associates the CustomTag with an XML namespace. This prefix is set using the xmlns attribute of the HTML tag.
CustomTagUser-defined tag.
sIDString that specifies a unique identifier for the object.

Members Table

PropertyDescription
availHeight Retrieves the height of the working area of the system's screen, excluding the Microsoft Windows® taskbar.
availWidth Retrieves the width of the working area of the system's screen, excluding the Windows taskbar.
bufferDepth Retrieves the number of bits per pixel used for colors on the off-screen bitmap buffer.
colorDepth Retrieves the number of bits per pixel used for colors on the destination device or buffer.
connectionType Retrieves the type of connection in use.
cookieEnabled Retrieves whether client-side cookies are enabled in the browser.
cpuClass Retrieves a string representing the CPU class.
height Retrieves the vertical resolution of the screen.
javaEnabled Retrieves whether the Microsoft virtual machine (Microsoft VM) is enabled.
platform Retrieves the platform on which the browser is running.
systemLanguage Retrieves the default language that the system is running.
userLanguage Retrieves the current user language.
width Retrieves the horizontal resolution of the screen.
MethodDescription
addComponentRequest Adds the specified component to the queue of components to be installed.
clearComponentRequest Clears the queue of all component download requests.
compareVersions Compares two version numbers.
doComponentRequest Downloads all the components that have been queued using addcomponentrequest.
getComponentVersion Retrieves the version of the specified component.
isComponentInstalled Retrieves whether the specified component is available.

Remarks

The members listed in the preceding table might not be accessible through scripting until the window.onload event fires. waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and that all the behavior's properties, methods, and events are available for scripting. to prevent a scripting error—which would indicate that the object does not support a particular member—do not use any of the behavior-defined members before the window.onload event fires.

the clientcaps behavior is available as of internet explorer 5, in the microsoft win32® and unix platforms.

Examples

This example retrieves all the properties exposed by the clientCaps behavior.

<HTML XMLNS:IE>
<HEAD>
<STYLE>
@media all {
IE\:clientCaps {behavior:url(#default#clientCaps)}
}
</STYLE>
</HEAD>
<BODY>
<IE:clientCaps ID="oClientCaps" />
<PRE id=oPre></PRE>
<SCRIPT>
<!--
function window.onload()
{
sTempStr = "availHeight    = " + oClientCaps.availHeight    + "\n" +
"availWidth     = " + oClientCaps.availWidth     + "\n" +
"bufferDepth    = " + oClientCaps.bufferDepth    + "\n" +
"colorDepth     = " + oClientCaps.colorDepth     + "\n" +
"connectionType = " + oClientCaps.connectionType + "\n" +
"cookieEnabled  = " + oClientCaps.cookieEnabled  + "\n" +
"cpuClass       = " + oClientCaps.cpuClass       + "\n" +
"height         = " + oClientCaps.height         + "\n" +
"javaEnabled    = " + oClientCaps.javaEnabled    + "\n" +
"platform       = " + oClientCaps.platform       + "\n" +
"systemLanguage = " + oClientCaps.systemLanguage + "\n" +
"userLanguage   = " + oClientCaps.userLanguage   + "\n" +
"width          = " + oClientCaps.width          + "\n" ;
oPre.innerText = sTempStr;
}
-->
</SCRIPT>
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

This example uses the getcomponentversion method of the clientcaps behavior to determine the browser version.

<SCRIPT>
function window.onload()
{
var sVersion = oClientCaps.getComponentVersion ("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid");
myText.innerHTML = "<FONT SIZE=4>You are running Internet Explorer " + sVersion + ".</FONT>";
}
</SCRIPT>
<BODY BGCOLOR="#FFFFFF" STYLE="behavior:url(#default#clientCaps)" ID="oClientCaps">
:
<DIV ID="myText"></DIV>   
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

This example shows how to install the Internet Explorer Data Binding component, if the component does not already exist in the user's system.

<HEAD>
<SCRIPT>
function window.onload()
{
// dynamically set the behavior through script
oClientCaps.style.behavior = "url(#default#clientCaps)";
var bDBAvailable  = false;
var sDBVersion = '';
var sDBID = "{9381D8F2-0288-11D0-9501-00AA00B911A5}";
bDBAvailable = oClientCaps.isComponentInstalled(sDBID,"componentid");
// if data binding is unavailable, install it
if (!bDBAvailable)
{
oClientCaps.addComponentRequest (sDBID, "componentid");
bDBAvailable = oClientCaps.doComponentRequest();
}
:
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" ID="oClientCaps">
:
<PRE ID="preText"></PRE>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

applies to

A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, nextID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XML, XMP

更多语法参考

about client capabilities, introduction to dhtml behaviors, Using DHTML Behaviors