I'm pretty sure that is not how the example from your previous question did it!
The following is similar to your demo but not quite...http://jsfiddle.net/fsjv7/1/
HTML
<html>
<head>
<title>Example</title>
</head>
<body>
<canvas id="example" style="border: 1px solid black" height="10" width="10"></canvas>
<br />
Don't place img tags into your document. Place Empty Canvas Tags (with unique names)
</body>
</html>
Javascript
// add items to this array to load more images into different canvas'
var resources = [
{
"destination": "example",
"src": "https://developer.mozilla.org/samples/canvas-tutorial/images/rhino.jpg"
}
];
var loadResources = function(obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
img = new Image();
img.src = obj[key].src;
img.onload = (function() {
var o = obj[key].destination;
return function() {
canvas = document.getElementById(o);
canvas.height = img.height;
canvas.width = img.width;
canvas.getContext("2d").drawImage(img, 0, 0);
}
})();
}
}
}
window.onload = loadResources(resources);