javascript 버튼 생성 바디에 붙이기 이동

javascript 버튼 생성 바디에 붙이기 이동

-

좋아요

Document 111111 .ff let body = document.querySelector('body') let c = document.createElement('button') body.appendChild(c) c.style.transition = "3s" c.innerText = "버튼" let d = document.createElement('button') body.appendChild(d) d.style.transition = "3s" d.innerText = "xxxx" d.style.left ="10px" d.style.top ="10px" d.style.position="relative" d.addEventListener('click',function(){ d.style.left ="200px" d.style.top ="200px" d.style.opacity = '0.2' }) c.addEventListener('click', function () { console.log(a) a = a + 50 c.style.width = a + "px"; let xxx = 10 c.innerText = xxx.toString(); // console.log('A'); // let ggg = 0 // for (let i = 0; i < 10; i++) { // setTimeout(function () { c.innerText = (xxx - i).toString() }, ggg) // ggg = ggg + 1000 // } // console.log('B'); c.style.width = "10px"; c.style.height = "10px"; // }) c.addEventListener('click', function () { if (a == 0) { c.style.width = "120px"; c.style.height = "120px"; a = 1 } else { c.style.width = "10px"; c.style.height = "10px"; a = 0 } ; })

from http://goodclickad.tistory.com/228 by ccl(A) rewrite - 2021-09-10 09:27:04