Home > Web Front-end > JS Tutorial > JavaScript code to calculate the number of images loaded_javascript skills

JavaScript code to calculate the number of images loaded_javascript skills

WBOY
Release: 2016-05-16 18:12:42
Original
1176 people have browsed it

Use JavaScript to calculate the number of currently loaded images.
Principle:
First define an array of images, and then calculate it through the onload event of the image. Note that onload is different in IE and Firefox.
Finally, a progress bar is needed to combine with it.
This script is often used in games.
Demo:

Copy code The code is as follows:


















正在准备载入游戏素材...

100%







Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template