All pastes #763286 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-06 10:12 UTC
rendered paste body
<a href="javascript:void(0);" onclick="showPics(-1)" id="prev">prev</a>
<img id="img1" src="thumb1.jpg" />
<img id="img2" src="thumb2.jpg" />
<img id="img3" src="thumb3.jpg" />
<a href="javascript:void(0);" onclick="showPics(1);" id="next">Next</a>

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

function wrap(index, length) {
  if (0 < index && index < length) { return index; }
  else if (0 < index) { return 0; }
  else { return length - index - 1; }
}

function showPics($stap) {
  $pos += $stap;
  document.getElementById('img1').src = $pad + $foto[wrap($pos-1, $foto.length)];
  document.getElementById('img2').src = $pad + $foto[wrap($pos, $foto.length)];
  document.getElementById('img3').src = $pad + $foto[wrap($pos+1, $foto.length)];
}

showPics(0);
</script>