목록Web (91)
taenyLog
convert.js:76 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '.45lbs' is not a valid selector. at file:///C:/Users/User/Desktop/Project1_lbsToKg/lbs2kg/convert.js:76:30 at Array.forEach () at HTMLButtonElement. (file:///C:/Users/User/Desktop/Project1_lbsToKg/lbs2kg/convert.js:74:10) (anonymous) @ convert.js:76 (anonymous) @ convert.js:74 CSS선택자에서 점다음에 숫자가 오는 것은 유효하지않다..
plate는 45 35 25 15 10 5개 가있고 아래의 이벤트리스너를 5개 만들어야하는 상황이였음 plate45.button.addEventListener("click", function () { totalKg += plate45.weight; totalKgDisplay.textContent = totalKg; const btn = document.createElement("BUTTON"); btn.innerHTML = "45lbs"; btn.class = "45lbs"; document.body.appendChild(btn); btn.addEventListener("click", function () { document.body.removeChild(btn); totalKg -= 20 * 2; to..
const plate45 = { weight: 20 * 2, button: document.querySelector("#plate45"), }; const plate35 = { weight: 15 * 2, button: document.querySelector("#plate35"), }; const plate25 = { weight: 11.34 * 2, button: document.querySelector("#plate25"), }; const plate15 = { weight: 6.8 * 2, button: document.querySelector("#plate15"), }; const plate10 = { weight: 4.53 * 2, button: document.querySelector("#p..
자바스크립트를 이용하여 문서에 HTML 요소를 추가할 수 있다. 이 때 필요한 자바스크립트 속성 .createElement() 요소를 만든다. .createTextNode() 선택한 요소에 텍스트를 추가 .appendChild() 선택한 요소안에 자식요소를 추가
const btn = document.createElement("BUTTON"); btn.innerHTML = "45LBS" document.body.appendChild(btn); 자바스크립트에서 버튼 생성하는 방법. const btn = document.createElement("BUTTON"); 1. 자바스크립트에서 버튼을 생성하기 위해서 메소드 호출하고 생성된 요소를 변수에 할당 btn.innerHTML = "45LBS" 2. 속성이있는 버튼에 일부텍스트를 할당 document.body.appendChild(btn); 3. 마지막으로 메소드를 사용하여 생성된 버튼을 body태그에 추가 ! https://www.3schools.in/2021/11/how-to-create-button-in-javas..
A 버튼 클릭시 B 버튼에 A 버튼의 객체가 복사되는 것을 만들고 싶었음 let a_left = {}; plate45.button.addEventListener("click", function () { totalKg += plate45.weight; totalKgDisplay.textContent = totalKg; a_left.weight = plate45.weight; }); a_left라는 변수를 만들고 plate45 버튼을 클릭시 a_left 변수의 weight에 plate45의 weight가 복사됨.

프로토타입은 JavaScript 객체가 서로 기능을 상속하는 매커니즘이다. const myObject = { city: "Madrid", greet() { console.log(`Greetings from ${this.city}`); }, }; myObject.greet(); // Greetings from Madrid city는 하나의 데이터 속성Madrid와 하나의 메서드greet()를 가진 객체이다. greet().와 같이 콘솔에 객체 이름뒤 마침표를 입력하면 콘솔이 기 객체에 사용할 수 있는 모든 속성 목록을 아래와 같이 팝업으로 표시 JavaScript의 모든 객체에는 프로토타입이라는 내장 속성이 있다. 프로토타입은 그 자체로 객체이므로 프로토타입은 자체 프로토타입을 갖게 되어 프로토타입 체인이..

단어를 검색하면 해당 티비쇼들이 보여진다. https://www.tvmaze.com/api TV API | TVmaze - Add TV information to your website or app. We provide a free, fast and clean REST API that's easy to use, returns JSON and conforms to the HATEOAS and HAL principles. The root url is https://api.tvmaze.com and the available endpoints are documented below. If you have any questions or suggestions re www.tvmaze.com 위 사이트의 API 이용...