What html tags support the onload/onerror javascript event attributes?

Bill the Lizard picture Bill the Lizard · Mar 25, 2009 · Viewed 22.9k times · Source

I'm familiar with the typical use of onload, as in the following:

<body onload="alert('Hello, World!');">
...
</body>

What are all the html elements that fire a load event? (thus executing javascript supplied in an onload attribute)

For example, img is one such tag that will execute the javascript supplied in an onload attribute when some.png has loaded:

<img onload="someImgLoaded()" src="some.png" />

Answer

Brian R. Bondy picture Brian R. Bondy · Mar 25, 2009

'onload' is supported by the following HTML tags:

<body>, <frame>, <frameset>, <iframe>, <img>, <link>, <script>

And the following Javascript objects:

image, layer, window