here is my code below. i have a lists of thumbnail images. when the user click a small thumbnail image, it swaps it to show the full image. i have been trying to get the anchor tag name so that, i can explode the value "i". but i get no luck, any ideas?
many thanks!
my javascript
function swap(image) {
document.getElementById("main").src = image.href;
}
my html & php script
<img id="main" src="images/main.jpg" width="226" height="226" alt="" />
<p><strong>Day <?php echo $i; ?>:</strong></strong><br /><?php echo $today[$i]; ?></p>
</div>
</div>
<?php
for($i=1; $i<$day; $i++)
{
echo'<a href="images/prevDay-'.$i.'.jpg" name="day-'.$i.'" onclick="swap(this); return false;">';
echo'<img src="images/thumbDay-'.$i.'.jpg" width="50" height="50" alt="" title="thumbDay-'.$i.'.jpg" /></a> ';
}
?>