Indicates the current state of the XML document.
Syntax
lValue = oXMLDOMDocument.readyState
Remarks
Long integer. The property is read-only. It returns a value that indicates the instantiation and download state of the XML document object. The value can be one of the following:
LOADING (1) | The load is in progress; reading persisted properties, but has not yet started parsing data. For purposes of the standard readyState definitions, data should be considered equivalent to BLOB properties. |
LOADED (2) | Reading of the persisted properties completed; reading and parsing data, but the object model is not yet available. |
INTERACTIVE (3) | Some data has been read and parsed and the object model is now available on the partially retrieved data set. Although the object model is available during this state, it is read-only. |
COMPLETED (4) | The document has been completely loaded, successfully or unsuccessfully. |
This member is an extension of the W3C DOM.
Example
The following JScript/HTML example demonstrates the sequence of ready states when asynchronously loading a document:
<script>
var xmldoc;
function Load()
{
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = CheckState;
xmldoc.load(URL.value);
}
function CheckState()
{
var state = xmldoc.readyState;
RESULTS.innerHTML += "readyState = " + state + "<BR>"
if (state == 4)
{
var err = xmldoc.parseError;
if (err.errorCode != 0)
RESULTS.innerHTML += err.reason + "<BR>"
else RESULTS.innerHTML +="success" + "<BR>"
}
}
<script>
URL: <input type=text size=60 id=URL>
<input type=button value=LOAD onclick="jscript:Load()">
<div id=RESULTS style= "color:red;font-weight:bold;"></div>
Applies To