Other Image Properties

来自Javascript Definitive Guide,了解<img>标签的属性

引用
In addition to the onload event handler demonstrated in Example 22-4, the Image object supports two others. The onerror event handler is invoked when an error occurs during image loading, such as when the specified URL refers to corrupt image data. The onabort handler is invoked if the user cancels the image load (for example, by clicking the Stop button in the browser) before it has finished. For any image, one (and only one) of these handlers is called.

Each Image object also has a complete property. This property is false while the image is loading; it is changed to true once the image has loaded or once the browser has stopped trying to load it. In other words, the complete property becomes true after one of the three possible event handlers is invoked.


除了onload,onerror,onabort这些图片加载周期中的句柄属性,还有一个complete属性,当加载完成会或者取消加载时,浏览器将设置成ture(也就是之前的那三个事件之一被触发),否则为false

还有些属性就是<img>标签自带的一些属性。

你可能感兴趣的:(JavaScript,浏览器)