본문 바로가기
728x90
반응형
SMALL

programming375

chapter 7) handle to javascript code in HTML first h1 tag second h2 tag ### Structure and Execution Order 1. **Head Script Tags**: - The first script defines an arrow function `h1` that takes a `text` argument and returns a string representing an `` element with that text. - The second script immediately tries to append an `` element to the `body` using `document.body.innerHTML += h1('first script tag')`. This script executes before the bo.. 2024. 12. 21.
python) Student Class and Its Functionality class Student: def __init__(self,name,korean,math,english,science): self.name = name self.korean = korean self.math = math self.english = english self.science = science def get_sum(self): return self.korean + self.math + self.english + self.science def get_average(self): return self.get_sum() / 4 def __str__(self): return "{}\t{}\t{}".format(self.name, self.get_sum(), self.get_average()) student.. 2024. 12. 20.
chapter 7) Keyboard event ### How It Works - **Event Listening for DOM Content Loaded**: The `DOMContentLoaded` event ensures that the JavaScript code runs only after the HTML document has been completely parsed. This is crucial for accessing DOM elements like ``. - **Query Selector for `` Element**: The `document.querySelector('h1')` method is used to select the first `` element in the document, which will be used to di.. 2024. 12. 19.
chapter 7) localStroage delete ### How It Works - **DOMContentLoaded**: The script waits for the DOM to fully load before querying elements and attaching event listeners, ensuring that the elements exist when the script tries to interact with them. - **Querying Elements**: It selects a paragraph (``), an input field (``), and a button (``) from the DOM for later manipulation. - **Retrieving and Displaying Saved Value**.. 2024. 12. 18.
728x90
반응형
LIST