Original
$ ("# Qrcode "). on ("LOAD", function () {$ (". loading "). hide (); alert (1) ;}// or document. getelementbyid ("qrcode "). onload = function () {$ (". loading "). hide (); alert (1 );}
It seems that there is no problem, but why is onload often not called in IE? Because the browser caches images, the second loaded image is not transmitted from the server and will not initiate a request. However, the complete attribute of the image will be added. Alert (1); it will be executed every time, so the guess is wrong.
Modify the Code as follows:
VaR IMG = new image (); IMG. onload = function () {document. getelementbyid ("qrcode "). setattribute ("src", this. SRC) $ ("# loading "). hide ();} IMG. src = "/img/img.jpg ";
The onload event is written before assigning a value to the SRC of the imgage object. It is normal to first tell the browser how to process the image and then specify the source of the image.
Therefore, it is not because the IE browser did not trigger the onload event, but because the loading speed of the buffer is so fast that the onload event has been triggered when it is not running to OBJ. onload.
Solution to IMG. onload failure in IE