Sometimes it is necessary to obtain the size of an image. This needs to be done after the image is loaded. How can I do this?
1. Load event
< !DOCTYPE HTML>
img - load event loading...
Tested, all browsers show "loaded" indicates that all browsers support the load event of img.
2. readystatechange event
< !DOCTYPE HTML>
img - readystatechange event loading...
readyState is complete and loaded indicates that the image has been loaded. Tested that IE6-IE10 support this event, other browsers do not support it.
3. Complete attribute of img
img - complete attribute loading...
Polling continuously monitors the complete attribute of img. If it is true, it indicates that the image has been loaded and stops polling. This attribute is supported by all browsers.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn