How do i store data with a Two Dimensional Array? Please help!!
Basically im trying to create a sudoku page, and the user inputs the numbers they want to into empty table cells and i want them to be able to save what they have done by clicking on a button. Ive got a two dimensional array but im not sure if it works because i dont know how to link the array with the button :/ im only just starting javscript at uni so im just a beginner. please help!
var current_cell = null; // the currently selected cell
var saved = {}; // Object for saving the current game
function initialize() {
var col, row;
// Work through all the cells in the table and set
// onclick event handlers and classNames for the empty
// ones.
for (row = 0; row <=8; row++) {
for (col=0; col <= 8; col++) {
var cell = document.getElementById('cell_' + col + '_' + row);
if (!parseInt(cell.innerHTML)) {
// cell is empty
cell.onclick = selectCell;
cell.className = 'tofill';
}
}
}
document.onkeypress = keyPress;
save();
}
var data = new array(9)
for (i=0; i <9 ; i++)
data[i] = new array(9)
Bookmarks