But I guess if you really wanted to use slice, I'd do it thus:
Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span onclick="showThree(-1)">left</span>
<p id="test"></p>
<span onclick="showThree(1)">right</span>
<script type="text/javascript">
var imageList = ["obr1.jpg","obr2.jpg","obr3.jpg","obr4.jpg"];
var listSize = imageList.length;
var images = imageList.concat( imageList ); // double the array
var curstart = 0;
function showThree(moveby)
{
curstart = ( curstart + listSize + moveby ) % listSize;
document.getElementById("test").innerHTML = images.slice( curstart, curstart + 3 );
}
showThree(0);
</script>
</body>
</html>