Edit in JSFiddle

function testUrl(imagePath) {
  var k=$("<img />").attr("src", imagePath);
  k.error(function() {
      debug('url error: '+imagePath+"\r\n");
  });
  k.load(function() {
      debug('url loaded: '+imagePath+"\r\n");
  });
}

function debug(mess) {
  $('#target').append('<p>'+mess+'</p>');
}

// test non-existant image
testUrl("/fish.jpg");
// test local js file
testUrl("/js/jslint.min.js");
// test local image
testUrl("/favicon.png");
// test remote image
testUrl("http://www.google.co.uk/images/srpr/logo3w.png");


<div id='target'><p>Test started:</p></div>