alert()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function a(){
alert("클릭하셨군요!");
}
</script>
</head>
<body>
<button onclick="a()">클릭</button>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
prompt("메시지", "기본값 입력")
사용자로부터 문자열을 입력 받아 리턴
confirm()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function a(){
name = prompt("이름을 입력하세요","");
document.writeln(name);
ok = confirm("결제할까요?");
if(ok){
document.writeln("결제 OK");
}else{
document.writeln("결제 CANCLE");
}
}
</script>
</head>
<body>
<button onclick="a()">클릭</button>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
'Javascript' 카테고리의 다른 글
제어문 - 선택문 - if, else if, else (+예시 학점 매기기, 월 계절 맞추기) (0) | 2020.03.10 |
---|---|
문자열 연산자 서론에 설명 조금 더하기 //String operator (0) | 2020.03.10 |
조건 연산자(삼항연산자) 조건? true:false (0) | 2020.03.09 |
비교 연산자, 논리 연산자 // Comparison operator, Logical operator (0) | 2020.03.09 |
산술 연산자 // Arithmetic Operators (0) | 2020.03.09 |