CompGeek01
07-03-2005, 12:47 AM
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.
It's late, maybe it'll look different to me tomorrow.
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();
}
It's late, maybe it'll look different to me tomorrow.
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();
}