2
<head>
<script type="text/javascript">
document.onreadystatechange = WaitForComplete;
function WaitForComplete() {
console.log ("The state of the document: " + document.readyState);
}
function OnLoad() {
console.log ("The document has been loaded.");
}
</script>
</head>
<body onload="OnLoad()">
</body>
在firefox->控制檯與readyState的一些代碼,它表明:試圖瞭解JS
The state of the document: interactive
The state of the document: complete
The document has been loaded.
問:
爲什麼每次我在Firefox上運行腳本,那隻能說明interactive
和complete
?如何對其他國家:由於您使用的是onreadystatechange
功能,而不是檢查上兩種狀態uninitialized,loading...
:uninitialized
,loading
...