Retrieves a value that indicates whether standards-compliant mode is switched on for the object.
dhtml语法
[ sMode = ] document.compatMode
DHTML可能的值
sMode | String that
receives one of the following values.BackCompat | Standards-compliant mode is not switched on. | CSS1Compat | Standards-compliant mode is switched on. |
|
The property is read-only.
The property has no default value.
Remarks
With Internet Explorer 6 and later, you switch on standards-compliant mode by including the !doctype declaration at the top of your document, specifying a valid label in the declaration, and in some cases, specifying the definition and/or url. the label specifies the unique name of the document type definition (dtd), and can be appended with the version number of the dtd. the definition specifies the definition of the dtd that is specified in the label. the url specifies the location of the dtd.
when standards-compliant mode is switched on, internet explorer renders the document in compliance with the cascading style sheets (css), level 1 (css1) standard. when standards-compliant mode is not switched on, rendering behavior is consistent with previous versions of internet explorer.
Examples
The !DOCTYPE declarations in the following examples specify conformance to the Transitional燞TML 4.0燚TD. The declaration in the second example specifies the URL of the DTD. The declaration in the first example does not. The second declaration switches on standards-compliant mode with Internet Explorer 6 and later. The first declaration does not.
The compatMode property returns BackCompat with documents containing the declaration in the following example. This declaration does not switch on standards-compliant mode because it does not specify the URL of the Transitional HTML 4.0燚TD.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
The compatMode property returns CSS1Compat with documents containing the declaration in the following example. This declaration switches on standards-compliant mode because it specifies the URL of the Transitional HTML 4.0燚TD.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
是否符合公共标准
There is no public standard that applies to this property.
Applies To
更多语法参考
CSS Enhancements in Internet Explorer 6