Element.readyState (Property)

The readyState of an object contains a value indicating whether it is currently loading or is ready to use.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Property/method value type:String primitive
JavaScript syntax:IEmyElement.readyState

This property contains the current disposition of the element object.

You might use this in a timed event to watch the status of a document being loaded into a window or frame. Then when it has completed loading, you could activate some script within it.

Here is a list of the ready state values:

State:Value:
uninitializedThe object is first instantiated, but has not begun loading.
loadingThe object has commenced loading.
loadedThe object has completed loading.
interactiveThe object is loaded but not yet closed. However, it is ready to handle interaction.
completeThe object body has been closed and the loading is finished.

Note that these are string values. Some references describe a numeric value for ready states. According to the Microsoft documentation however, they are strings.

Sometimes, you can design scripts to execute while the document is downloading. Inline scripts for example. At that time, you may even be able to trigger interval timed deferred executions as well.

An object may not need to reflect the complete status before you can commence operating on it. Other objects may require that they are completely loaded. For example, you cannot create an OBJECT object that represents an <OBJECT> tag until the <BODY> has completed loading. This is because the ActiveX object construction requires a complete document body structure to attach itself to.

Every time this readyState value changes, it triggers an onReadyStateChange event call-back.

See also:onReadyStateChange

Property attributes:

ReadOnly.