Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1021B

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Память | Memory</title>
  5. </head>
  6. <body>
  7. </body>
  8. <script src="../shared/javaScript.js"></script>
  9. <script>
  10. var items = []
  11. // Section16Buttons.
  12. for (var i = 0; i < 16; i++) {
  13. let item = document.createElement("div")
  14. document.body.appendChild(item)
  15. items.push(item)
  16. item.id = `${i}`
  17. }
  18. // SectionGrid.
  19. var M = {
  20. itemsCount: items.length
  21. };
  22. let positions = memoryItemPositions(M);
  23. for (var id in positions) {
  24. var p = positions[id]
  25. var item = items[id];
  26. item.style.left = `${p.x}px`
  27. item.style.top = `${p.y}px`
  28. item.style.width = `${memorySide()}px`
  29. item.style.height = `${memorySide()}px`
  30. item.style.position = "absolute"
  31. item.style.background = "blue"
  32. }
  33. // SectionSelection.
  34. for (let id in items) {
  35. var item = items[id]
  36. item.onclick = function() {
  37. console.log("ИГР select id:", id)
  38. }
  39. }
  40. </script>
  41. </html>