Home >Web Front-end >JS Tutorial >Alternative usage of img's onload_Image special effects
I believe everyone often uses the onload event of images, especially when controlling the output size of images.
But onload has some special uses. For example, I am doing ajax recently and need to load it during onload. I usually use the window's onload event, but the window's onload event must be executed after all HTML elements are loaded (including all pictures, if there are pictures on the page It will be troublesome if it is lost).
Many JS library classes, such as jquery and prototype, have corresponding functions to simulate implementation.
We can also use the onload method of the image to achieve this.
For example: It can be realized.