Please help! I have been cracking this for days but no avail.. :( I can't hide/ show Previous / Next buttons as of my following scenarios..
I have a 3 images array. Each individual image is shown using Previous / Next buttons. The scenario are as follows:
P1 Image is shown: Hide Previous Button, show Next Button
P2 Image is shown: Show Previous & Next Button
P3 image is shown: Hide Next Button, Show Previous Button
My codes are as follows:
Javascript:
var myPix = new Array()
myPix[0] = 'P1.jpg'
myPix[1] = 'P2.jpg'
myPix[2] = 'P3.jpg'
var thisPic = 0
function doPrevious() {
if (document.images && thisPic > 0) {
thisPic--
document.myPicture.src=myPix[thisPic]
}
}
function doNext() {
if (document.images && thisPic < 2) {
thisPic++
document.myPicture.src=myPix[thisPic]
}
}
HTML codes:
Previous / Next Buttons here:
<td height="47" align="right">
<a href="javascript:doPrevious()" title="Previous">
<img src="PrevBtn.jpg" width="120" height="35" border="0" />
</a>
<a href="javascript:doNext()" title="Next">
<img src="NextBtn.jpg" width="120" height="35" border="0" />
</a>
</td>
Image shown here:
<table border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td>
<img id="pic" name="myPicture" src="P1.jpg" />
</td>
</tr>
</table>