Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

memory.html 1016B

1 년 전
1 년 전
1 년 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Память | Memory</title>
  5. </head>
  6. <body>
  7. </body>
  8. <script>
  9. var items = []
  10. // Section16Buttons.
  11. for (var i = 0; i < 16; i++) {
  12. let item = document.createElement("div")
  13. document.body.appendChild(item)
  14. items.push(item)
  15. item.id = `${i}`
  16. }
  17. // SectionGrid.
  18. let side = Number(50)
  19. let space = Number(20)
  20. let gap = Number(side + space)
  21. for (var id in items) {
  22. var item = items[id]
  23. let row = Math.floor(id / 4)
  24. let x = gap + (id - row * 4) * gap
  25. let y = gap + row * gap
  26. item.style.left = `${x}px`
  27. item.style.top = `${y}px`
  28. item.style.width = `${side}px`
  29. item.style.height = `${side}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>