For example:
Copy Code code as follows:
<input id= "btnpost" type= "button" value= "button"/>
When the browser is parsing, the input label is loaded first, and then the IMG tag is loaded.
At this point, if you want to determine whether the IMG tag is loaded, you can add a script around the IMG tag, such as
Code
Copy Code code as follows:
<div id= "Loading" ></div>
<input id= "btnpost" type= "button" value= "button"/>
<script type= "Text/javascript" >
var msg = document.getElementById ("Imga");
if (msg = null) {
document.getElementById ("Loading"). InnerHTML = "Building picture control ...";//the settimeout function does not work here
}
</script>
<script> document.getElementById ("Loading"). InnerHTML = "";</script>
Note that the IMG tag before and after the JS code, the above JS code to get an IMG object, and then determine whether the object is empty, if it is empty, the description is not loaded, then prompts the user "is building picture control", the completion of the load will be prompted to hide information.
The above method applies to all controls or labels, but for controls or labels that have a onload event on their own (the event is triggered after the corresponding control or tag is loaded), we can encapsulate the code behind the IMG as a function for the onload call, as follows
Code
Copy Code code as follows:
<script type= "Text/javascript" >
function loadedimg () {document.getElementById ("Loading"). InnerHTML = "";}
</script>
<body >
<input id= "AutoComplete"/>
<div id= "Loading" ></div>
<input id= "btnpost" type= "button" value= "button"/>
<script type= "Text/javascript" >
var msg = document.getElementById ("Imga");
if (msg = null) {
document.getElementById ("Loading"). InnerHTML = "is picture control ...";//the settimeout function does not work here
}
</script>
</body>
As you can see from the code above, the code behind the IMG tag has been encapsulated into the Loadedimg method called by IMG's onload.
Which controls or labels have the onload event? I checked on the Internet, as follows (do not know all):
<body>, <frame>, <frameset>, <iframe>, , <link> <script>
All right, that's it, leave a message.