Новый текстовый документ.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. var sudoku = [
  2. [
  3. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  4. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  5. [1, 2, 3, 4, 5, 6, 7, 8, 9]
  6. ],
  7. [
  8. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  9. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  10. [1, 2, 3, 4, 5, 6, 7, 8, 9]
  11. ],
  12. [
  13. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  14. [1, 2, 3, 4, 5, 6, 7, 8, 9],
  15. [1, 2, 3, 4, 5, 6, 7, 8, 9]
  16. ],
  17. ]
  18. var table, row, cell, i, j;
  19. table = document.createElement('table');
  20. table.style.textAlign = 'center';
  21. table.style.borderCollapse = 'collapse';
  22. table.style.fontFamily = 'Arial, sans-serif';
  23. for (i = 1; i < 10; i++) {
  24. row = document.createElement('tr');
  25. for (j = 1; j < 10; j++) {
  26. cell = document.createElement(i == 1 || j == 1 ? 'th' : 'td');
  27. cell.appendChild(document.createTextNode(i * j));
  28. cell.style.padding = '5px';
  29. cell.style.border = '2px solid #ccc';
  30. cell.style.width = 100 / 9 + '%';
  31. row.appendChild(cell);
  32. }
  33. if (i % 2 == 0) {
  34. row.style.backgroundColor = '#e2e2e2';
  35. }
  36. table.appendChild(row);
  37. }
  38. document.body.appendChild(table);