I have a array that holds 24 items (hour in a day). The table is make of week day and hours. Monday is the only day I got going so far. I trying to make it that when you click on specific hour for a day it does two thing. One is change of the cell color, which I’v done and two is that I can get an array of hightlighted cells to feed to php in a hidden form field. Also the array add and Subtract items when clicked or clicked again to remove hightlight. Number two is where I am stuck.
var mycars = new Array(25);
function testResults (mycars, id, field, field2) {
if(mycars[id] == id + 'on' ){
//mycars[id] = id;
} else {
mycars[id] = id;
}
var quote = "";
for (var i = 1; i < mycars.length; i++){
if(!mycars[i]){
//mycars[i] = id;
//quote += mycars[i] + "u ";
quote += ". ";
} else {
// mycars.splice(i,1,i " on");
quote += mycars[i] + " ";
if(mycars[i]==id + 'on'){
//quote += id;
quote += "_r ";
quote += mycars.splice(i, 0, "v");
//mycars[i] = "v";
}
if(mycars[i]==id) {
mycars[id] = id + 'on';
}
}
}
var len = mycars.length;
len += "Length is " + len;
field.value = quote;
field2.value = len;
}
The table cells have this form an onClick:
testResults(mycars, this.id, myform.remLen, myform.remqaz);
I have tryed creating to array with no items in it- nothing ex(new Array()).
tryed having the function create the array- nothing.
I can get in the items to add to the array but I cant get them out when needed. The splice will not work right. If it takes out the item it then the rest of the array index go down by 1. I tryed to reset th item by splice(i, 0, “some var”) and nothing works.
Thank you for any thought on getting me in the right road.
Boot Straps