mardi 29 novembre 2016

onerror Event didn`t work

I try create code which replace src image on another. I want to use function invalidUrl():

function invalidUrl() {
    paint.src = randomvariable;
}

but this function isn`t running :<

var paint = '<img src="' + url + '"class="heightImg" onerror="invalidUrl()"/>' + '</br></br>' + description;

How to change src images if current picture doesn`t exist?




Aucun commentaire:

Enregistrer un commentaire