views:

51

answers:

2

How to display an image using JavaScript from an array creating in JavaScript.

Any help please?

Thanks.

+1  A: 

You can create an image in JavaScript: var img = new Image(); img.src = "path-to-image"; and then add it to the DOM (depending on if you're using a js library like jQuery or not this will vary in complexity). Can you be more specific as to your circumstances?

thenduks
+3  A: 

If you've got an image tag in your HTML layout, with a given id, you can control its content with javascript:

function updateFullImage(id, url) {
    var img = document.getElementById(id);
    img.src = url ;
}

and the browser (FF at leat) will automatically reload your image

Kevin