Sfoglia il codice sorgente

the work has began

miskson 3 anni fa
parent
commit
7ec8aebf3b
1 ha cambiato i file con 75 aggiunte e 1 eliminazioni
  1. 75 1
      hw4/script.js

+ 75 - 1
hw4/script.js

@@ -1 +1,75 @@
-console.log('henlo')
+let obj = {
+    body: {
+        tagName: 'body',
+        attrs: {},
+        paired: true,
+        children: [
+            {
+                tagName: 'div',
+                attrs: {},
+                paired: true,
+                children: [
+                    {
+                        tagName: 'span',
+                        attrs: {},
+                        paired: true,
+                        children: ['Enter data please:']
+                    },
+        
+                    {
+                        tagName: 'br',
+                        paired: false
+                    },
+        
+                    {
+                        tagName: 'input',
+                        attrs: {
+                            type: 'text',                            
+                            id: 'name'
+                        },
+                        paired: false
+                    },
+        
+                    {
+                        tagName: 'input',
+                        attrs: {
+                            type: 'text',
+                            id: 'surname'
+                        },
+                        paired: false
+                    }
+                ]
+            },
+            {
+                tagName: 'div',
+                attrs: {},
+                paired: true,
+                children: [
+                    {
+                        tagName: 'button',
+                        attrs: {
+                            id: 'ok'
+                        },
+                        paired: true,
+                        children: ['Ok']
+                        
+                    },
+                    {
+                        tagName: 'button',
+                        attrs: {
+                            id: 'cancel'
+                        },
+                        paired: true,
+                        children: ['Cancel']
+                    },
+                ],
+            },
+        ]
+    }
+}
+
+console.log(obj.body.children[0].children[0].children[0])
+
+console.log(obj.body.children[1].children[1].attrs.id)
+console.log(obj.body.children[0].children[1].tagName)
+