All pastes #763244 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-06 09:11 UTC
rendered paste body
<a href="javascript:void(0);" onclick="showPics(-1)" id="prev" style="display:none;">prev</a>
<img id = "img1" src="" />
<img id = "img2" src="" />
<img id = "img3"  src="" />
<a href="javascript:void(0);" onclick="showPics(1);showPrev();" id="next" style="display:none;">Next</a>

<script>
 $pad ='../../gfx/thumb/'; 
 $foto = new Array();
 $foto[0] = 'thumb1.jpg';
 $foto[1] = 'thumb2.jpg';
 $foto[2] = 'thumb3.jpg';
 $foto[3] = 'thumb4.jpg';

 //laat volgende zien als er meer dan drie images zijn
 if ($foto.length > 3)
 {
	document.getElementById('next').style.display = 'block';
 }
 
 function showPrev() {
	document.getElementById('prev').style.display = 'block';
 }


 for(i=0; i<$foto.length; i++) { 
 //alert('bla');
 }

 //laat afbeeldingen zien
 function showPics($stap) {
	 if (($stap + 1) > $foto.length) 
	 {
	  $stap = 0;
	 }
	 if (($stap -1) < 0) 
	 {
	  $stap = $foto.lenght;
	 }

	 alert($stap);
	 document.getElementById('img1').src = $pad + $foto[$stap-1];
	 document.getElementById('img2').src = $pad + $foto[$stap];
 	 document.getElementById('img3').src = $pad + $foto[$stap+1];

	 }

showPics(0);
</script>