Post

Web 스터디-6. JavaScript

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
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
    <script>
        Math.random() 
        //랜덤숫자
        alert('경고창')
        confirm('확인취소창')
        prompt('입력받기')
        alert(prompt('입력값 계산')*0.1)
        alert('계산값 횔용'+prompt('결과')*0.1)
        document.querySelector('body') // 특정 태그 선택
        document.querySelector('body').remove // 선택된 태그 삭제 -> 파일을 건드리진 않았으므로 새로고침하면 돌아옴
        document.querySelector('body').style.backgroundColor='black'; //다크모드->바디 영역을 블랙으로 바꾼다.
        document.querySelector('body').style.color='white'; //폰트 색 바꾸기
        document.location.href; //document라는 객체로 구분되어 기능을 정의-> 중복의 위험성을 최소화
    </script>
</head>
<body>
    
</body>
</html>

ㅡㅡㅡㅡㅡㅡㅡㅡㅡ 적용예 ㅡㅡㅡㅡㅡㅡㅡㅡㅡ <!DOCTYPE html>

Document
This post is licensed under CC BY 4.0 by the author.