onreadystatechange Event

onreadystatechange Event

Fires when the state of the object has changed.

Syntax

Inline HTML<ELEMENT onreadystatechange = "handler" ... > All platforms
Event propertyobject.onreadystatechange = handlerJScript only
object.onreadystatechange = GetRef("handler")Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = object EVENT = onreadystatechange> Internet Explorer only

Event Information

BubblesNo
CancelsNo
To invoke Change the ready state.
Default action Signals the ready state of the document.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

altKey Sets or retrieves a value that indicates the state of the ALT key.
altLeft Sets or retrieves a value that indicates the state of the left ALT key.
ctrlLeft Sets or retrieves the state of the left CTRL key.
shiftLeft Retrieves the state of the left SHIFT key.
srcElement Sets or retrieves the object that fired the event.
type Sets or retrieves the event name from the event object.

Remarks

You can use the readyState property to query the current state of the element when the onreadystatechange event fires.

All elements expose an onreadystatechange event. The following objects always fire the event because they load data: applet, document, frame, frameSet, iframe, img, link, object, script, and xml elements. Other objects will only fire the onreadystatechange event when a DHTML Behavior is attached.

When working with behaviors, wait for the onreadystatechange event to fire and verify that the readyState property of the element is set to complete to ensure that the behavior is completely downloaded and applied to the element. Until the onreadystatechange event fires, if you use any of the behavior-defined members before attaching the behavior to the element, a scripting error can result, indicating that the object does not support that particular property or method.

Example

This example uses the onreadystatechange event to invoke a function when the readyState is complete.

document.onreadystatechange=fnStartInit;
function fnStartInit()
{
if (document.readyState=="complete")
{
// Finish initialization.
}
}

Standards Information

There is no public standard that applies to this event.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值