HTML 참고서/HTML 생활코딩 Youtube
3. JavaScript 사용자와 커뮤니케이션
Or71nH
2020. 4. 10. 17:38
### 알람 설정 alert
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="button" value="confirm" onclick="func_confirm()" />
<script>
function func_confirm(){
if(confirm('ok?')){
alert('ok');
} else {
alert('cancel');
}
}
</script>
</body>
이것은 알람 선택을 할 수 있는 방법이다
### 로그인 설정 prompt
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="button" value="prompt" onclick="func_prompt()" />
<script>
function func_prompt(){
if(prompt('id') === 'egoing'){
alert('welcome');
} else {
alert('fail');
}
}
</script>
</body>
로그인을 하는 방법의 기초이다
문자를 비교하여 맞는지 틀리는지 알려준다