Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

<title>20225501_안나경</title>

JavaScript 실습


<script> let a = 3, b = 5; document.write(a+b +"
"); b = "5"; document.write(a+b); for(let size=10; size<=35; size+=5) { // 5씩 증가 document.write("
"); document.write(size + "px"); document.write("
"); } </script>

배경색 변경하기 1 배경색 변경하기 2

<script> let now = new Date(); document.write("현재 시간 : " + now.toLocaleString() + "
"); document.write("
"); let div = document.getElementById("div"); let button = document.getElementById("button"); button.addEventListener("click", bubble, false); document.body.addEventListener("click", bubble, false); document.body.addEventListener("click", capture, true); function capture(e) { let obj = e.currentTarget; let tagName = obj.tagName; div.innerHTML += "
capture 단계 : " + tagName + " 태그 "; } function bubble(e) { let obj = e.currentTarget; let tagName = obj.tagName; div.innerHTML += "
bubble 단계 : " + tagName + " 태그 "; } function bgColorChange_m() { let input = prompt("RGB 값을 입력하세요 (예 : 255, 255, 255) : "); let color = input.split(","); let bgColor = "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")"; let b = document.getElementById("main"); b.style.background = bgColor; } function bgColorChange_a() { alert("배경색을 임의로 변경합니다"); let x = Math.floor(Math.random()*255); let y = Math.floor(Math.random()*255); let z = Math.floor(Math.random()*255); let bgColor = "rgb(" + x + "," + y + "," + z + ")"; let b = document.getElementById("main"); b.style.background = bgColor; } </script>
이름
학점
제출 <script> function process(){ let name = document.getElementById("name"); let grade = document.getElementById("grade"); let obj = document.getElementById("main"); let newDIV = document.createElement("div"); newDIV.innerHTML = name.value; newDIV.setAttribute("id", "myDiv");

if(grade.value == "A"){ newDIV.style.backgroundColor = "green"; newDIV.innerHTML += " 적격 판정" }else{ newDIV.style.backgroundColor = "red"; newDIV.innerHTML += " 부적격 판정" } newDIV.onclick = function() { let p = this.parentElement; p.removeChild(this); } obj.appendChild(newDIV); } </script>

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages