<!DOCTYPE html>
<html>
<head>
<script>
function e() {
document.getElementById("output").value += "Error event handler called\n";
}
function l() {
document.getElementById("output").value += "Image.complete is " +
document.getElementById('img').complete + "\n";
}
</script>
</head>
<body onload="l();">
<img id="img" src="data:invalid" onerror="e();">
<br>
<textarea id="output" cols="50" rows="10"></textarea>
</body>
</html>