<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<!-- 클릭시 경고창 -->
<input type="button" value="alert" onclick="alert('hello world');">
</body>
</html>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<input type="button" value="confirm" onClick="func_confirm()" />
<script>
function func_confirm() {
if(confirm('ok??')) {
alert('ok');
} else {
alert('cancel');
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<input type="button" value="prompt" onclick="func_prompt()" />
<script>
// 사용자가 입력한 값을 버튼에 삽
function func_prompt() {
var answer = prompt('button value : ');
document.querySelector('input').value = answer;
}
</script>
</body>
</html>