Specifies the event handler to be called when the readyState property changes.
objXMLDOMDocument.onreadystatechange = value
The property is write-only. When using scripting languages, this property can be set in ways other than directly accessing the property through the DOMDocument object. It can also be set using the onreadystatechange attribute of the <XML> tag, and the SCRIPT FOR... construct.
This member is an extension of the W3C DOM.
The following JScript/HTML example specifies the handler CheckState gets called when the readyState property changes:
<script> var xmldoc; function Load(){ xmldoc = new ActiveXObject("Msxml2.DOMDocument"); 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></script>
In VBScript, you can get a function pointer using the syntax getRef("HandleStateChange")
.
Applies To: DOMDocument Object