L
lawrence
Sorry for the dumb question but I'm new to Javascript. I wrote this
script hoping to animate some div blocks on a page. You can see the
page here: http://www.keymedia.biz/demo.htm
Can anyone tell me why these DIVs don't drift to the left as they are
supposed to?
<script language="javascript">
var allDivs = new array();
allDivs[] = "todd1";
allDivs[] = "todd2";
allDivs[] = "todd3";
allDivs[] = "todd4";
allDivs[] = "todd5";
allDivs[] = "todd6";
allDivs[] = "todd7";
allDivs[] = "todd8";
allDivs[] = "todd9";
allDivs[] = "todd10";
allDivs[] = "todd11";
allDivs[] = "todd12";
allDivs[] = "todd13";
allDivs[] = "todd14";
allDivs[] = "todd15";
allDivs[] = "todd16";
allDivs[] = "todd17";
allDivs[] = "todd18";
allDivs[] = "todd19";
allDivs[] = "todd20";
allDivs[] = "todd21";
allDivs[] = "todd22";
allDivs[] = "todd23";
allDivs[] = "todd24";
allDivs[] = "todd25";
allDivs[] = "todd26";
allDivs[] = "todd27";
allDivs[] = "todd28";
allDivs[] = "todd29";
allDivs[] = "todd30";
allDivs[] = "todd31";
allDivs[] = "todd32";
allDivs[] = "todd33";
allDivs[] = "todd34";
allDivs[] = "todd35";
allDivs[] = "todd36";
allDivs[] = "todd37";
allDivs[] = "todd38";
allDivs[] = "todd39";
allDivs[] = "todd40";
var thisDiv = "";
var howFarLeft = 0;
function moveDivs() {
for (i=0; i < count(allDivs); i++) {
thisDiv = allDivs;
document.getElementById(thisDiv).style.visibility='visible';
howFarLeft = document.getElementById(thisDiv).style.left;
if (thisDiv == "todd1") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd2") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd3") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd4") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd5") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd6") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd7") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd8") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd9") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd10") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd11") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd12") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd13") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd14") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd15") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd16") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd17") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd18") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd19") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd20") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd21") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd22") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd23") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd24") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd25") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd26") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd27") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd28") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd29") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd30") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd31") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd32") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd33") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd34") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd35") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd36") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd37") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd38") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd39") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd40") howFarLeft = howFarLeft - 4;
if (howFarLeft < -1500) howFarLeft = 9000;
document.getElementById(thisDiv).style.left = howFarLeft;
setTimeOut("moveDivs()", 100);
}
}
</script>
script hoping to animate some div blocks on a page. You can see the
page here: http://www.keymedia.biz/demo.htm
Can anyone tell me why these DIVs don't drift to the left as they are
supposed to?
<script language="javascript">
var allDivs = new array();
allDivs[] = "todd1";
allDivs[] = "todd2";
allDivs[] = "todd3";
allDivs[] = "todd4";
allDivs[] = "todd5";
allDivs[] = "todd6";
allDivs[] = "todd7";
allDivs[] = "todd8";
allDivs[] = "todd9";
allDivs[] = "todd10";
allDivs[] = "todd11";
allDivs[] = "todd12";
allDivs[] = "todd13";
allDivs[] = "todd14";
allDivs[] = "todd15";
allDivs[] = "todd16";
allDivs[] = "todd17";
allDivs[] = "todd18";
allDivs[] = "todd19";
allDivs[] = "todd20";
allDivs[] = "todd21";
allDivs[] = "todd22";
allDivs[] = "todd23";
allDivs[] = "todd24";
allDivs[] = "todd25";
allDivs[] = "todd26";
allDivs[] = "todd27";
allDivs[] = "todd28";
allDivs[] = "todd29";
allDivs[] = "todd30";
allDivs[] = "todd31";
allDivs[] = "todd32";
allDivs[] = "todd33";
allDivs[] = "todd34";
allDivs[] = "todd35";
allDivs[] = "todd36";
allDivs[] = "todd37";
allDivs[] = "todd38";
allDivs[] = "todd39";
allDivs[] = "todd40";
var thisDiv = "";
var howFarLeft = 0;
function moveDivs() {
for (i=0; i < count(allDivs); i++) {
thisDiv = allDivs;
document.getElementById(thisDiv).style.visibility='visible';
howFarLeft = document.getElementById(thisDiv).style.left;
if (thisDiv == "todd1") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd2") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd3") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd4") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd5") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd6") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd7") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd8") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd9") howFarLeft = howFarLeft - 1;
if (thisDiv == "todd10") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd11") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd12") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd13") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd14") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd15") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd16") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd17") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd18") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd19") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd20") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd21") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd22") howFarLeft = howFarLeft - 2;
if (thisDiv == "todd23") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd24") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd25") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd26") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd27") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd28") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd29") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd30") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd31") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd32") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd33") howFarLeft = howFarLeft - 3;
if (thisDiv == "todd34") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd35") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd36") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd37") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd38") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd39") howFarLeft = howFarLeft - 4;
if (thisDiv == "todd40") howFarLeft = howFarLeft - 4;
if (howFarLeft < -1500) howFarLeft = 9000;
document.getElementById(thisDiv).style.left = howFarLeft;
setTimeOut("moveDivs()", 100);
}
}
</script>