js new image() code example
Example: show image javascript
JS:
function setImageVisible(id, visible) {
var img = document.getElementById(id);
img.style.visibility = (visible ? 'visible' : 'hidden');
}
HTML:
<img id="myImageId" src="yourImage.png">
Then, your links would be:
<a href="javascript:setImageVisible('myImageId', true)">show image</a>
<a href="javascript:setImageVisible('myImageId', false)">hide image</a>
CSS:
#theImage { visibility: hidden; }