Skip to content

Instantly share code, notes, and snippets.

@marcobeltempo
Created January 6, 2018 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcobeltempo/faf52638a157d19a7c0a9ce652edd544 to your computer and use it in GitHub Desktop.
Save marcobeltempo/faf52638a157d19a7c0a9ce652edd544 to your computer and use it in GitHub Desktop.
Lab 11 Test Case
var img = new Image(100, 100);
img.src = 'https://i2.wp.com/www.marcobeltempo.com/wp-content/uploads/2016/05/mb_logo_38x38.png?fit=38%2C38&ssl=1';
document.body.appendChild(img);
img.onload = function() {
document.getElementsByTagName("body")[0].style.backgroundColor = "red";
}
img.onerror = function() {
alert("Error");
};
img.src = 'https://i2.wp.com/www.marcobeltempo.com/wp-content/uploads/2016/05/mb_logo_38x38.png?fit=38%2C38&ssl=1'
document.body.appendChild(img);
img.onload = function() {}
img.onerror = function() {
alert("Error");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment