This article mainly introduces the method of loading images sequentially in javascript, which can achieve the successive loading of images in javascript, thus reducing the pressure on the server, which is of great practical value, for more information about how to load images in javascript sequence, see the following example. Share it with you for your reference. The details are as follows:
Javascript listens to whether an image has been loaded. If loading is complete and then loads the next image, it is not a one-time load from the server to reduce the load on the server,
Available places: for example, creating apps similar to google Maps can load images one by one.
Function Load_pic (arr) {this. loop_f = function (I, o_file, len, f, obj) {if (I
0) {if ($. browser. version = 6.0 | $. browser. version = 9.0) {// Like IE9 and IE6, Microsoft is really a weird image. onreadystatechange = function () {if (image. readyState = "complete") {obj. loop_f (I, o_file, len, f, obj) ;}}}else {ie7imagetime = window. setInterval (function () {var rs = image. readyState; if (rs = "complete") {window. clearInterval (ie7imagetime); obj. loop_f (I, o_file, len, f, obj) ;}else {return ;}, 200) ;}} else {image. onload = function () {if (image. complete = true) {obj. loop_f (I, o_file, len, f, obj) ;}}}; if (arr. constructor = Array) {var len = arr. length, I = 0; I
I hope this article will help you design javascript programs.