<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function showPic(whichPic){
var imgSource = whichPic.getAttribute("href");
var placeHolder = document.getElementById("placeholder");
placeHolder.setAttribute("src", imgSource);
placeHolder.setAttribute("height", 400);
}
</script>
<h1>Image placeholder</h1>
<a href="pics/wolf_1.jpg" onclick="showPic(this); return false;">Wolf 1</a>
<a href="pics/wolf_2.jpg" onclick="showPic(this); return false;">Wolf 2</a>
<a href="pics/wolf_3.jpg" onclick="showPic(this); return false;">Wolf 3</a>
<a href="pics/wolf_4.jpg" onclick="showPic(this); return false;">Wolf 4</a>
<a href="pics/wolf_5.jpg" onclick="showPic(this); return false;">Wolf 5</a><br>
<img id="placeholder" src="pics/placeholder.gif">
</body>
</html>
I want to loop through anchor tag so that I can embed code on <script> tag, not in line script like onclick="showPic(this); return false;" , do you have any solution?