Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

is there an opposit of onerror html

var img = document.getElementById('img');
var imgURL = "/path/to/new_img.png";
img.addEventListener('error', refresh);
img.addEventListener('load', refresh); // ***
img.src = imgURL;

function refresh(e) {
    img.src = imgURL;
    if (e.type !== "error") {
        img.removeEventListener('error', refresh);
        img.removeEventListener('load', refresh);
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #opposit #onerror #html
ADD COMMENT
Topic
Name
2+6 =