hw07_05.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <header>
  2. <h1>Parent</h1>
  3. </header>
  4. <body>
  5. <script>
  6. html =
  7. {
  8. "tagName": "body",
  9. "children": [
  10. {
  11. "tagname": "div",
  12. "children": [
  13. {
  14. "tagName": "span",
  15. "children": [
  16. "Enter a data please:"
  17. ],
  18. },
  19. {
  20. "tagName": "br"
  21. },
  22. {
  23. "tagName": "input",
  24. "attrs": {
  25. "type": "text",
  26. "id": "name"
  27. }
  28. },
  29. {
  30. "tagName": "input",
  31. "attrs": {
  32. "type": "text",
  33. "id": "surname"
  34. }
  35. }
  36. ]
  37. },
  38. {
  39. "tagName": "div",
  40. "children": [
  41. {
  42. "tagName": "button",
  43. "attrs": {
  44. "id": "ok"
  45. },
  46. "children": [
  47. "OK"
  48. ]
  49. },
  50. {
  51. "tagName": "button",
  52. "attrs": {
  53. "id": "cancel"
  54. },
  55. "children": [
  56. "Cancel"
  57. ]
  58. }
  59. ]
  60. }
  61. ]
  62. };
  63. html.children[0].parent = html;
  64. html.children[1].parent = html;
  65. html.children[0].children[0].parent = html.children[0];
  66. html.children[0].children[1].parent = html.children[0];
  67. html.children[0].children[2].parent = html.children[0];
  68. html.children[0].children[3].parent = html.children[0];
  69. html.children[1].children[0].parent = html.children[1];
  70. html.children[1].children[1].parent = html.children[1];
  71. </script>
  72. </body>