About the Image object onload event.
What you want to get is the width and height value of image. So use the onload method. Another is the remote image obtained.
But when IE displays the picture for the second time, it always does not go through the onload method. Code:
var img = new Image(); = ""; = function(){ var iheight = ; var iwidth = ; };
Later, after reading it for Xiaoniu, I found out that it should be placed behind the onload method. .
Later on Google, I found that everyone has summarized such issues. . I'm really an amateur. .
Because IE does not trigger the onload method when loading buffer data, the code in the event is ignored. FF triggers the onload method when loading buffer data.
In fact, there is another point, that is, when onload, you need to adaptively adjust the image, and you find that you need to set the elements in the onload again. . . Or it only remembers the first picture. . .
I still have only a little understanding of this buffer area. continue.