Please someone give me insight into why the SHIFT RIGHT function doesn’t work. It’s pretty much the opposite of the left shift function….but it just doesn’t work.
[code]
function updateMe() {
box = document.getElementById(“pictures”);
box.innerHTML = ”;
for (x=0; x<pictures.length; x++)
{
box.innerHTML += pictures[x];
}
}
function shiftLeft() {
box = document.getElementById(“pictures”);
var saveMe = pictures[0];
for(x=0; x<pictures.length-1; x++)
{
pictures[x] = pictures[x+1];
}
pictures[pictures.length-1] = saveMe;
updateMe();
}
function shiftRight() {
box = document.getElementById(“pictures”);
var goAway = pictures[pictures.length-1];
for(x=1; x<pictures.length; x++)
{
pictures[x] = pictures[x-1];
}
pictures[0] = goAway;
updateMe();
}
I haven’t done a lot in JS, but logically I swear this should work.