I've been looking for ways to change the anchor link through JavaScript. Luckily, I found this site that helped me with the solution: WebSewak's Techjunk.
I just want to post the solution here so that I won't forget about it.
I just want to post the solution here so that I won't forget about it.
<script language="javascript" type="text/javascript">
var boardpics = new Array();
var boardpicsLarge = new Array();
boardpics['1'] = 'images/product/medium/22_1_.jpg';
boardpicsLarge['1'] = 'images/product/large/22_1_.jpg';
boardpics['2'] = 'images/product/medium/22_2_.jpg';
boardpicsLarge['2'] = 'images/product/large/22_2_.jpg';
boardpics['3'] = 'images/product/medium/22_3_.jpg';
boardpicsLarge['3'] = 'images/product/large/22_3_.jpg';
function changeImagesrc(id){
document.productimg.src = boardpics[id];
document.getElementById('productimgID').href = boardpicsLarge[id];}
function changeImagesrc1(){
document.productimg.src = 'images/product/medium/22.jpg';}
</script>
No comments:
Post a Comment