onreadystatechange对象发生改变时激发
来源:互联网 发布:d.o电影成绩知乎 编辑:程序博客网 时间:2024/04/30 09:41
Fires when the state of the object has changed.
当对象发生改变时激发。
Syntax
语法
Inline HTML <ELEMENT onreadystatechange = "handler" ... > All platforms
Event property object.onreadystatechange = handler JScript 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
Bubbles No
Cancels No
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 an event object for data.
Show 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.
HideExample
document.onreadystatechange=fnStartInit;
function fnStartInit()
{
if (document.readyState=="complete")
{
// Finish initialization.
}
}
<script>
var img=null;
function s()
{
if(img)
img.removeNode(true);
img=document.createElement("img");
img.style.position="absolute";
img.style.visibility="hidden";
img.attachEvent("onreadystatechange",orsc);
img.attachEvent("onerror",oe);
document.body.insertAdjacentElement("beforeend",img);
img.src=inp.value;
}
function oe()
{
alert("cant load img");
}
function orsc()
{
if(img.readyState!="complete")return false;
alert("高:"+img.offsetHeight+"/n宽:"+img.offsetWidth);
}
</script>
<input type="file" Name="file" id="inp" value="默认值"><br>
<input onclick="s()" type="button" value="点我一下给出要上传图片的大小及长、宽" name="button">
- onreadystatechange对象发生改变时激发
- 观察者模式:当一个对象状态发生改变时,通知依赖他的全部对象都发生改变
- 迭代的对象发生改变
- onreadyStateChange
- 鼠标悬浮时发生的效果改变
- 有关map压入对象后,对象的数据成员发生改变的问题
- calloc指向发生改变
- 激发国际功夫世界国际复合的结果就发生
- onchange 事件会在域的内容改变时发生。
- javascript技巧--鼠标经过时图片发生改变
- 配置项发生改变时保持程序状态
- TextBox内容发生改变时触发的事件
- 求ASPxGridView 当数据源发生改变时 怎么刷新
- kindeditor内容发生改变时相关处理例子
- EventHandle事件委托(通过状态发生改变时判断)
- 分配内存空间时指针的地址发生改变
- 读取excel中数据时,数字格式发生改变
- 核心对象激发状态的意义
- 在JSP中使用JavaMail
- 类似msn可以弹出提示框,同时可以点击连接
- VC数据库开发日记5: CSTring和COleDateTime相互转化
- 文言文辞职信
- richfaces标签例子
- onreadystatechange对象发生改变时激发
- JSP生成验证码源程序
- 漂亮MM想嫁有钱人 金融家的回复令人叫绝
- 用C#将html网页保存为mht格式文件
- 使用xManager远程连接linux图形化界面
- Eclipse与插件安装
- 学了一个新术语: Webinar
- dos命令收藏
- WINPCAP发送自己构造的数据包问题