Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- livereload
- 웹 테스트 이미지
- 팬톤 색상 웹
- color site
- Devtools
- 테스트 이미지
- 새로고침
- test image
- Spring
- RGB 생성
- springboot
- RGB WEB
Archives
- Today
- Total
기억은 휘발성 메모리
Java Script gugudan 본문
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>구구단</h1>
<span> 단 : </span>
<input id = "input" type = "text" value="8">
<input id = "button" type = "button">
<p id = "gugu"></p>
<script>
function print() {
var dan = document.getElementById("input").value;
var gugudan = "";
for (var i = 1; i < 10; i++) {
gugudan += dan + " x " + i + " = " + dan * i + "</br>";
}
document.getElementById("gugu").innerHTML = gugudan;
}
document.getElementById("button").onclick = print;
</script>
</body>
</html>
Method | Description |
---|---|
document.getElementById(id) | Find an element by element id |
document.getElementsByTagName(name) | Find elements by tag name |
document.getElementsByClassName(name) | Find elements by class name |
출처 : w3schools.com
teg에 id를 부여하고 document.getElementById("id")를 이용해 <script> teg내에서 해당 id의 teg를 변경할 수 있다.
(BOM) The Browser Object Model
Java의 최상위 객체 object
Browser의 최상위 객체 window
'Program Language > Java Script' 카테고리의 다른 글
Java Script jQuery (0) | 2018.05.17 |
---|---|
Java Script Debugging (0) | 2018.05.08 |
Java Script Object vs Array (0) | 2018.05.08 |
Java Script 시간 출력 (0) | 2018.05.03 |
Comments