I moderne kode ser det sådan ud:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tjek for billedes eksistens</title>
<style type="text/css">
#errMsg {
font-weight: bold;
color: red;
}
</style>
</head>
<body>
<div id="errMsg"> </div>
<script type="text/javascript">
var oImg = new Image();
oImg.onerror = function(){document.getElementById("errMsg").firstChild.nodeValue = "Fejl 1"};
oImg.onabort = function(){document.getElementById("errMsg").firstChild.nodeValue = "Fejl 2"};
//oImg.onload = function(){document.getElementById("errMsg").firstChild.nodeValue = "Ingen fejl"};
oImg.onload = function(){
var oMsg = document.getElementById("errMsg");
var o = document.createElement("img");
o.setAttribute("src", oImg.src);
oMsg.parentNode.replaceChild(o, oMsg);
};
oImg.src = "
http://www.eksperten.dk/img/recycle1.gif";</script>
</body>
</html>