-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_bom.html
More file actions
43 lines (43 loc) · 1.47 KB
/
06_bom.html
File metadata and controls
43 lines (43 loc) · 1.47 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BOM</title>
</head>
<body>
<!-- Clipboard -->
<input id="text" /><br />
<input id="text2" /><br />
<button id="copy">복사</button>
<button id="paste">붙여넣기</button>
<button onclick="location.href = 'https://naver.com'">네이버로 가기</button>
<button onclick="location.reload()">새로고침</button>
<button onclick="window.open('https://naver.com')">
네이버 새 창 열기
</button>
<script>
// Clipboard
const text = document.querySelector("#text");
const text2 = document.querySelector("#text2");
const copy = document.querySelector("#copy");
const paste = document.querySelector("#paste");
copy.addEventListener("click", () => {
navigator.clipboard.writeText(text.value);
// localhost, https. -> http. x.
});
paste.addEventListener("click", async () => {
const copyText = await navigator.clipboard.readText();
text2.value = copyText;
});
// 2. location -> 주소창. 접속 주소.
console.log(location);
// host : 접속주소
// protocol : 접속방식
// ........
// href
// location.href = 현재 접속한 문서의 레퍼런스 주소.
// -> 이걸 변경시키면 접속한 링크가 바뀜 (<a href="">)
</script>
</body>
</html>