1HTML:
2<img id="theImage" src="yourImage.png">
3<a id="showImage">Show image</a>
4
5JavaScript:
6document.getElementById("showImage").onclick = function() {
7 document.getElementById("theImage").style.visibility = "visible";
8}
9
10CSS:
11#theImage { visibility: hidden; }
1JS:
2function setImageVisible(id, visible) {
3 var img = document.getElementById(id);
4 img.style.visibility = (visible ? 'visible' : 'hidden');
5}
6
7HTML:
8<img id="myImageId" src="yourImage.png">
9Then, your links would be:
10<a href="javascript:setImageVisible('myImageId', true)">show image</a>
11<a href="javascript:setImageVisible('myImageId', false)">hide image</a>
12
13CSS:
14#theImage { visibility: hidden; }