function saveForm() {
var array = [];
array.push(txtTName.value + "," + txtTNumber.value + "," + txtProjName.value + "," + getTotal());
var scores = document.getElementById("scores");
scores.innerHTML += "<br \>" + array[0] + array[1] + array[2];
}
Here's my code. So when a button is pushed it calls "saveForm()" which saves the values into an array and displays them. The first time its called it displays "xxxxx undefined undefined" the next time it calls "yyyyyy undefined undefined". Shouldn't it be returning "xxxxx yyyyy undefined"?
I'm only displaying elements 0,1, and 2 right now for testing purposes.
function saveForm(){
var array = [];
var list = txtTName.value + "," + txtTNumber.value + "," + txtProjName.value + "," + getTotal();
array.push(list);
var scores = document.getElementById("scores");
scores.innerHTML += "<br \>" + array[0] + array[1] + array[2];
}
Here's an edited version of saveForm(). The values don't really matter, I'm more wondering if there's a reason its only changing the first element. Do I need to create array outside of the function?