I have an array in my javascript funktion.
var data = ['Datum','Schicht','Schicht','Schicht','Dispo','Schicht','Schicht','Schicht','Schicht','Schicht','Schicht','Dispo'];
This array is displayed into a html table multiple times. The values should in the end be functions. Right now they are all just placeholders. What I want is to set them as functions, so when I use data[0] it calls the function 'date();' which displays me the current date. The function 'Schicht();' should be called on the placeholders seen above.
EDIT:
maybe I should post some more Information. So the array is put into an html table that i generate.
function tableCreate(){
var header = ['Datum','VoMi +D','Vo + NaMi','NaMi I','NaMi Dispo','Abend I/a','Abend I/b','Abend II','Abend III','Abend IV','Abend V','Abend Dispo'];
var data = ['Datum','Schicht','Schicht','Schicht','Dispo','Schicht','Schicht','Schicht','Schicht','Schicht','Schicht','Dispo'];
var html = '<table><thead><tr>';
for (var x=0; x < 12; ++x){
html += '<th>' + header[x] + '</th>';
}
html += '</tr></thead><tbody>';
for (var i = 0; i < 28; ++i) {
html += '<tr>';
for (var j = 0; j < 12; ++j) {
//var func = windows[data[j]];
html += '<td>' + [data[j] + '</td>';
}
html += "</tr>";
}
html += '</tbody></table>';
$(html).appendTo('#tabs1-schicht');
}
And the date function for example that I try to call is:
var date = function date(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = dd+'.'+mm+'.'+yyyy;
console.write(today);
}