-----------readyState---------------Definition and usage
The ReadyState property returns the status of the current document (Loading ... )。
The property returns the following values:
- Uninitialized-loading not yet started
- Loading-GTA5-in
- Interactive-loaded, the document and the user can start interacting
- Complete-Loading completed
Grammar Document.readystate
This property is read-only and returns the following possible values:
The 0-uninitialized:xml object is generated, but no files are loaded.
1-loading: The loader is in progress, but the file has not started parsing.
2-loaded: Some of the files have been loaded and parsed, but the object model has not yet taken effect.
3-interactive: Valid only for partially loaded files, in which case the object model is valid but read-only.
4-completed: The file has been fully loaded, representing a successful load.
-----------onreadystatechange---------------First:
IFRAME onreadystatechange events only for ie5.5 or later
Frame does not support onreadystatechange events
For IFRAME
<iframe name= "Ifm_test" src= "http://www.google.cn" onreadystatechange= "Fnstartinit ()" ></iframe>
or write in JS:
<iframe name= "Ifm_test" ></iframe>
<script language= "JavaScript" >
function LoadFile ()
{
Document.frames ("Ifm_test"). location.href= "http://www.google.cn";
Document.frames ("Ifm_test"). Onreadystatechange=fnstartinit ();
}
function Fnstartinit ()
{
if (Document.frames ("Ifm_test"). readystate== "complete")
{
Alert ("The framework file is loaded! ");
}
}
For frame:
<frameset cols= "*,*" >
<frame name= "Ifm_test" src= "http://www.google.cn"/>
<frame name= "Ifm_test1" src= "http://www.baidu.cn"/>
</frameset>
can only write in JS:
<script language= "JavaScript" >
Document.onreadystatechange = ready;
function Ready ()
{
if (document.readystate = = "complete")
{
Alert ("The framework file is loaded! ");
}
}
</script>
HTML readyState Property iframe onreadystatechange event