18 out of 27 rated this helpful - Rate this topic

readyState property

[This documentation is preliminary and is subject to change.]

Retrieves a value that indicates the current state of the object.

Syntax

JavaScript

p = object.readyState

Property values

Type: String

uninitialized

Object is not initialized with data.

loading

Object is loading its data.

loaded

Object has finished loading its data.

interactive

User can interact with the object even though it is not fully loaded.

complete

Object is completely initialized.

Remarks

An object's state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through the loaded and interactive states to reach the complete state.

The states through which an object passes are determined by that object; an object can skip certain states (for example, interactive) if the state does not apply to that object.

Data source objects and databound elements are normally populated asynchronously, and certain programmatic operations can only be performed reliably on databound objects when they are ready for use. Therefore, the appropriate code should be written to confirm the readyState of objects prior to performing certain operations on them. For example, walking the rows of a table should not be attempted until after the table has reached the complete state.

The readyState property enables the status of an object to be tested. The correct place to test the readyState property is in the event handler for onreadystatechange. Similarly, a data source object (DSO) fires the ondatasetcomplete event to notify the document that the dataset is ready for programmatic operation.

See also

document
frame
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
link
script
table
tBody
td
tFoot
th
tHead
tr
onreadystatechange

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Will it work for JavaScript as well
I found away using this trick (may not be nice but it worked for me):
Note ; "q" is only used to verify the status in a LIVE debugging.

        'q=0
        Do While appIE.Document.ReadyState <> 4
            DoEvents
            'Debug.Print q & " - " & appIE.Document.ReadyState
            If appIE.Document.ReadyState = "complete" Then
                Exit Do
            End If
            'q = q + 1
        Loop
RE: Will it work for JavaScript as well
I found away using this trick (may not be nice but it worked for me):
Note ; "q" is only used to verify the status in a LIVE debugging.

        'q=0
        Do While appIE.Document.ReadyState <> 4
            DoEvents
            'Debug.Print q & " - " & appIE.Document.ReadyState
            If appIE.Document.ReadyState = "complete" Then
                Exit Do
            End If
            'q = q + 1
        Loop
msdn.microsoft.com/en-us/community/add/ms534359(v=Vs.85)
addadd
it's in html5
http://www.w3.org/TR/html5/dom.html#current-document-readiness
so the "standards info" block can be updated.
receive complete before receive loaded

in my case,when i load js file dynamicly with createlement(script). in onreadystatechange handler,i check readystate, if found complete before loaded.

readyState does not indicate error
If the element cannot load the source for whatever reason, its ready state is set to complete.
deficiency - clipBoard/dataTransfer lacks readyState
There's no way to know whether it is ready to paste.