This is a paragraph.<\/p>\n <\/body>\n<\/html>\n<\/pre>\n\n\n\n
?? DOM ??? ??? ????.
\n<\/p>\n\n
Document\n └── html\n └── body\n ├── h1\n └── p\n<\/pre>\n\n\n\n\n
\n\n\n \n \n 2. DOM ?? ???<\/strong>\n<\/h3>\n\n
?? ?? ??? ???? DOM? ??? ???? ? ????. <\/p>\n\n
\n \n \n getElementById ??<\/strong>\n<\/h4>\n\n\n\n
let title = document.getElementById(\"title\");\nconsole.log(title); \/\/ Logs the element with ID \"title\"\n<\/pre>\n\n\n\n\n \n \n getElementsByClassName ??<\/strong>\n<\/h4>\n\n\n\n
let items = document.getElementsByClassName(\"item\");\nconsole.log(items); \/\/ Logs all elements with class \"item\"\n<\/pre>\n\n\n\n\n \n \n querySelector ? querySelectorAll ??<\/strong>\n<\/h4>\n\n\n\n
let firstItem = document.querySelector(\".item\"); \/\/ First element with class \"item\"\nlet allItems = document.querySelectorAll(\".item\"); \/\/ All elements with class \"item\"\n<\/pre>\n\n\n\n\n
\n\n\n \n \n 3. DOM ?? ??<\/strong>\n<\/h3>\n\n
\n \n \n ??? ??<\/strong>\n<\/h4>\n\n
??? ???? ?? ??? ???? HTML? ????? ? ????. <\/p>\n\n
\n
- \ninnerText<\/strong>: ???? ???? ???????.\n<\/li>\n
- \ninnerHTML<\/strong>: HTML ???? ???????.\n<\/li>\n<\/ul>\n\n
let title = document.getElementById(\"title\");\ntitle.innerText = \"Updated Title\"; \/\/ Changes visible text\ntitle.innerHTML = \"Updated Title<\/strong>\"; \/\/ Adds HTML formatting\n<\/pre>\n\n\n\n\n \n \n ??? ??<\/strong>\n<\/h4>\n\n
??? CSS ???? ?? ??? ? ????.
\n<\/p>\n\nlet title = document.getElementById(\"title\");\ntitle.style.color = \"blue\";\ntitle.style.fontSize = \"24px\";\n<\/pre>\n\n\n\n\n \n \n ?? ?? ?? ??<\/strong>\n<\/h4>\n\n\n\n
let box = document.getElementById(\"box\");\nbox.classList.add(\"highlight\"); \/\/ Adds a class\nbox.classList.remove(\"highlight\"); \/\/ Removes a class\n<\/pre>\n\n\n\n\n
\n\n\n \n \n 4. ??? ??<\/strong>\n<\/h3>\n\n
???? ???? ????? ????? ?? ? ????. ??? ? ?? ???? ??? ??? ?? ???? ?????. <\/p>\n\n
\n \n \n ??? ??? ??<\/strong>\n<\/h4>\n\n
HTML:
\n<\/p>\n\n