jQuery: Check if an image succesfully loads 

$(function(){

//prevent image cache
$('#a_img').attr('src',$('#a_img').attr('src')+'?rand='+Math.floor(Math.random()*10000));

//check for loading errors
$('#a_img').load().error(function(){

/* Legacy support kicking in */
var LegacyImg='http://www.example.com/dbimages/tag/h1/img_name.jpeg';
$('#a_img').attr('src',LegacyImg);

});

})


[ view entry ] ( 1353 views )   |  print article

<<First <Back | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Next> Last>>



2025 By Angel Cool