์๋ ํ์ธ์ ๋ถ์คํฐ์ฝ์ค 3๊ธฐ ์ํฌํฐ์ฆ ํ๋ธ์ ๋๋ค. ๐ฟ
๋ถ์คํฐ์ฝ์ค๋?
์ปค๋ฅํธ์ฌ๋จ์ ๋ค์ด๋ฒ๊ฐ ์ค๋ฆฝํ ๋น์๋ฆฌ ๊ต์ก ์ฌ๋จ์
๋๋ค.
์ํํธ์จ์ด ๊ฐ๋ฐ์ ์์ฑ ๊ต์ก ํ๋ก๊ทธ๋จ, ๋ถ์คํธ์ฝ์ค์ ํจ๊ป
๋น์ ์ ๊ฐ๋ฐ ์ปค๋ฆฌ์ด๋ฅผ ์
๊ทธ๋ ์ด๋ํ์ธ์!
์ ํฌ์คํ ์ ๊ฐ์ ๋ด ์๊ฐํด๋ณด๊ธฐ์ ์์ ์์ ๋ค๋ฃจ๋ ์ฝ๋๋ฅผ ์ง์ ํฌ๋กฌํ๋ฉด์์ ํ์ธ ํด๋ณผ ์ ์๋๋ก ์งํํฉ๋๋ค. ๊ด๋ จ๋ ๊ฐ๋ ๊ณผ ๊ฐ์๋ ํจ๊ป ์ฌ๋ ค๋๋ฆฌ๋ ๋งํฌ์์ ํ์ธํด๋ณด์ค ์ ์์ต๋๋ค.
www.boostcourse.org/cs124/joinLectures/52258
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
var ๋น์ฒจ์์ = 2;
var ๋๊ธ์ ํ์ = '๋๊ธ ์ฃผ์';
function shuffle(a){
for(let i = a.length; i; i--){
let j = Math.floor(Math.random() * i);
[a[i-1],a[j]] = [a[j],a[i-1]];
}
}
var list = [];
document.querySelectorAll(๋๊ธ์ ํ์).forEach(function(e){
list.push(e.innerText);
});
list = list.filter((v,i,a) => a.indexOF(v) ===i);
shuffle(list)
console.log(list.slice(0,๋น์ฒจ์์));
์ด ์ฝ๋๋ ์ ๋ฒ ์๊ฐ ์ฝ์ ๊ฐ์์์ ์๋ฐ ์คํฌ๋ฆฝํธ๋ฅผ ํ์ฉํด์ ํ์ด์ค๋ถ ๋๊ธ ์ถ์ฒจ ์ด๋ฒคํธ๋ฅผ ๋ง๋ ์ฝ๋์์ต๋๋ค. ๋ฐ๋ก ์์ ๋ก ์ฌ๋ผ์ค์ง ์์ ์ด๋ ๊ฒ ์ฝ๋๋ก ์์ฑํ์ฌ ์ฌ๋ ค๋๋ฆฝ๋๋ค.
6. ๋ฐ์ดํฐ ํ์ (๋ฌธ์์ด๊ณผ ์ซ์)
www.boostcourse.org/cs124/lecture/194588
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์๋ฃํ
์ซ์(number)
๋ฌธ์์ด(String)
๋ฌธ์์ด์ธ์ง ์ซ์์ธ์ง์ ๋ฐ๋ผ ์ฐ์ฐ์ ๊ฒฐ๊ณผ๊ฐ ํฌ๊ฒ ๋ฌ๋ผ์ง ์ ์๋ค
'helloworld'.toUpperCase();
"HELLOWORLD"
'helloworld'.indexOf('o');
4
1+1
2
'1'+'1'
"11"
์๊ฐํด๋ณด๊ธฐ
-
1+2๋ฅผ ๊ณ์ฐํ์ ๋์ "1"+"2"๋ฅผ ๊ณ์ฐํ์ ๋์ ๊ฒฐ๊ณผ๋ ๊ฐ๊ฐ ์ด๋ป๊ฒ ๋ ๊น์? ์ ์ด๋ฐ ์ฐจ์ด๊ฐ ๋ฐ์ํ๋ ๊ฒ์ผ๊น์?
→ 1+ 2๋ ์ซ์์ด๊ธฐ ๋๋ฌธ์ 3์ด๋ผ๊ณ ๊ณ์ฐ ๋๋ ๊ฒ์ด๊ณ '1'+'2' ๋ ๋ฌธ์์ด๊ธฐ ๋๋ฌธ์ '12'๋ผ๊ณ ๊ณ์ฐ๋๋ ๊ฒ์ด๋ค.
7. ๋ณ์์ ๋์ ์ฐ์ฐ์
https://www.boostcourse.org/cs124/lecture/194589
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
x =1;
y = 1;
console.log(x+y);
var name = 'egoing';
var s = ' Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor doloremque '+name+ ' perferendis '+name+' itaque temporibus';
console.log(s);
๋ณ์์ ํจ์ฉ์ฑ์ ์์๋ณผ ์ ์๋ค.
๋ง์ฝ name ์ด 1์ต๊ฐ๊ฐ ๋ค์ด๊ฐ๋ค๊ณ ํ ๋ ๋ค ๋ฐ๊พธ๊ธฐ์๋ ์ด๋ ต๊ธฐ ๋๋ฌธ์ ๋ณ์๋ง ๋ฐ๊ฟ์ฃผ๋ฉด ๋ชจ๋ name์ ๋ฐ๊ฟ์ค ์ ์๋ ๊ฒ์ด๋ค.
์๊ฐํด๋ณด๊ธฐ
-
๊ฐ์์์ ์ธ๊ธ๋ ๊ฒ ์ธ์ ๋ณ์๋ฅผ ์ฌ์ฉํ ๋ ์ข์ ์ ์๋ ์ด๋ค ๊ฒ๋ค์ด ์์๊น์?
→ ๊ฐ์ ์์๋ก ์ ์ฅํด๋๊ณ ์ซ์๋ฅผ ๋ฐ๊พผ๋ค๊ฑฐ๋, ๊ณ์ ์ฐ์ด๋ ๊ฐ์ ์ ์ฅํด๋๋ฉด ์ ์ฉํ๋ค.
8. ์น๋ธ๋ผ์ฐ์ ์ ์ด
https://www.boostcourse.org/cs124/lecture/194590/
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์์ํ๊ธฐ ์ ์ ๊ฐ๋จํ๊ฒ ๋ช ๊ฐ์ง๋ฅผ ์ง๊ณ ๋์ด๊ฐ ๋ด ์๋ค. ๋จผ์ ์ด ์น์ฌ์ดํธ์ ์๊น์ด ์ด๋ ๊ฒ ๋ฐ๋๊ธฐ ์ํด์๋ <body> ํ๊ทธ์ ์์ฑ์ด ๋ฐ๋์ด์ผ ํ๋ค๋ ์ฌ์ค์ ๋๋ค.
<body>
<body style="background-color: black; color: white;">
์ ์ด๋ ๊ฒ ๋ณด์๋ฉด ๋ค์ด๋ฒ ๋ถ์คํธ์ฝ์ค๋ aside์ body๋ก ๋๋์ด ๋ ์ด์์์ด ๋ง๋ค์ด์ ธ์๋ค๋ ๊ฒ์ ์ ์๋ ์์ต๋๋ค. black ์ ๊ธ์จ๊ฐ ์๋ณด์ฌ์ gray๋ก ํ๋ฒ ๋ฐ๊พธ์ด ๋ณด์์ต๋๋ค.
์ฌ๋ฌ๋ถ๋ค๋ ํฌ๋กฌ์ ๊ฒ์ฌ์ฐฝ์ ์ผ์ body์ ๋ฐฐ๊ฒฝ ์์ ์์ ํด๋ณด์๊ธฐ ๋ฐ๋๋๋ค.
์๊ฐํด๋ณด๊ธฐ
-
์ง์ body ํ๊ทธ์ style ์์ฑ์ ๋ฐ๊พธ์ด ๋ฐฐ๊ฒฝ ์์ ํ๋์, ๊ธ์ ์์ ํ์์ผ๋ก ๋ง๋ค์ด ๋ด ์๋ค.
๋ถ์คํธ์ฝ์ค ์ฌ์ดํธ์ ๋ฐฐ๊ฒฝ์ ๋ฐ๊พธ์ด๋ณด์์ต๋๋ค. blue๋ ๊ธ์จ๊ฐ ๋๋ฌด ์๋ณด์ฌ์ ์กฐ๊ธ ์ฐํ ๋ธ๋ฃจ๋ก ๋ฐ๊พธ์ด ๋ณด์์ต๋๋ค.
9. CSS๊ธฐ์ด(style ์์ฑ)
https://www.boostcourse.org/cs124/lecture/194591
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์ด ๋ ์ด color: blue๋ผ๋ ์ฝ๋๊ฐ ๋ฐ๋ก CSS์ ๋๋ค.
CSS๋ฅผ ์ด์ฉํ๋ฉด ๋ค์ํ ์ข ๋ฅ์ ๋์์ธ ์์๋ฅผ ๋ฐ๊ฟ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด color ๋์ background-color์ ์ฐ๋ฉด ๋ฐฐ๊ฒฝ ์์ด ๋ฐ๋๋ ๊ฒ์ ๋ณผ ์ ์์ ๊ฒ๋๋ค.
์ด๋ฌํ ์์๋ค์ ์์๋ณด๊ณ ์ถ๋ค๋ฉด CSS property + "์ํ๋ ๋์์ธ ์์" ๋ก ๊ฒ์ํด๋ณด์๋ฉด ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด "CSS property background color"๋ก ๊ฒ์ํ๋ฉด, ๋ฐฉ๊ธ ๋ฐฐ์ด background-color๋ผ๋ CSS ์์ฑ์ ๋ํด์ ์์๋ณด์ค ์ ์์ ๊ฒ๋๋ค.
<h1>Javascript<h1>
<h1 style="color: blue">Javascript<h1>
์ด ์ธ์๋ ๋ค์ํ ๋ฐฉ๋ฒ์ผ๋ก css๋ฅผ ์ ์ฉ์ํฌ ์ ์๋๋ฐ ๊ทธ๊ฒ์ ์น UI ์ฝ์ค๋ฅผ ๋ณด์๋ฉด ๋์ฑ ์ดํด๊ฐ ์ฌ์ฐ ์ค ๊ฒ ๊ฐ์ต๋๋ค.
์๊ฐํด๋ณด๊ธฐ
-
๊ฐ์์์ ๋ฐฐ์ด color์ background-color์ ์ด์ฉํด์ ๋ฐฐ๊ฒฝ์ด ์ด๋ก์์ด๊ณ ๊ธ์๊ฐ ํฐ์์ธ ๋ฌธ๋จ์ ๋ง๋ค์ด ๋ด ์๋ค.
-
CSS๋ฅผ ์ด์ฉํด์ ๊ธ์ ํฌ๊ธฐ๋ฅผ ํค์๋ด ์๋ค. (ํํธ : CSS property font size ๋ผ๊ณ ๊ฒ์ํด ๋ณด์ธ์!)
<h1 style="font-size:50px;">boostcouse javaScript</h1>
<h1 style="color:white; background-color:green">boostcouse javaScript</h1>
10. CSS๊ธฐ์ด(style ํ๊ทธ)
https://www.boostcourse.org/cs124/lecture/194592
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์ฐ๋ฆฌ๊ฐ CSS๋ฅผ ์ด์ฉํด์ ๋ฌธ๋จ์ ํน์ ๋ถ๋ถ์๋ง ์คํ์ผ์ ์ฃผ์ด์ ๊ฐ์กฐ๋ฅผ ํ๊ณ ์ถ๋ค๊ณ ํด ๋ด ์๋ค. ์ด ๋ ์ด ๋ถ๋ถ์ ๊ฐ์ธ์ค ์ ์๋ HTML ํ๊ทธ๊ฐ ํ์ํ๊ฒ ์ฃ .
์ด๋ฅผ ์ํด์ ์ฐ๋ฆฌ๋ div์ span์ด๋ผ๋ ํ๊ทธ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
๋ ๋ชจ๋ ์ด๋ ํ ํน์ ํ ๊ธฐ๋ฅ์ด ์๋ ํ๊ทธ๊ฐ ์๋๊ณ , CSS๋ Javascript ์ฝ๋๋ฅผ ์ฝ์
ํ๊ธฐ ์ํด์ ์กด์ฌํ๋ ํ๊ทธ์
๋๋ค. div ํ๊ทธ๋ ํ๋ฉด ์ ์ฒด๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์ค๋ฐ๊ฟ์ด ๋๊ณ , span์ ์ค๋ฐ๊ฟ์ด ๋์ง ์์ต๋๋ค.
์ด์ ์ด๋ฌํ div์ span ํ๊ทธ ์์ style ์์ฑ์ ๋ถ์ฌํ๋ฉด ์ด ํ๊ทธ๋ก ๊ฐ์ธ์ง ๋ถ๋ถ์๋ง ๋์์ธ์ด ์ ์ฉ๋๊ฒ ๋ฉ๋๋ค.
ํ์ง๋ง ์ด๋ ๊ฒ ๋ชจ๋ ๋ถ๋ถ์ div๋ span ํ๊ทธ๋ก ๊ฐ์ธ๋ ค๊ณ ํ๋ค๋ฉด ์ด๋ฅผ ์ฐ๊ธฐ๋ ํ๋ค๊ณ , ์์ ํ๊ธฐ๋ ๋์ฑ ํ๋ค ๊ฒ์ ๋๋ค. ์ด๋ฅผ ์ํด์ CSS์๋ ์ ํ์๋ผ๋ ๊ธฐ๋ฅ์ด ์กด์ฌํฉ๋๋ค.
Class
์ด๋ฅผ ์ํด์๋ <head> ํ๊ทธ ์์ <style>์ด๋ผ๋ ์๋ก์ด ํ๊ทธ๋ฅผ ๋ง๋ค์ด ์ค๋๋ค. ์ด style ํ๊ทธ ์์๋ CSS ์ฝ๋๊ฐ ๋ค์ด๊ฐ๊ฒ ๋ฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ js๋ผ๋ class๋ฅผ ์์ฑํด ๋ด ์๋ค. ์๋ ์ฝ๋์ ๊ฐ์ด ๋ง์ด์ฃ
<head>
<style>
.js {
font-weight: bold;
}
</style>
</head>
์ด ๋ js ์์ ์ฐํ์๋ ์ ์ js๋ผ๋ ์ด๋ฆ์ด class ์ด๋ฆ์ด๋ผ๋ ๊ฒ์ ๋ํ๋ ๋๋ค. ์ด๋ ๊ฒ class๋ฅผ ๋ง๋ค์์ผ๋, ์ด๋ฅผ HTML ์ฝ๋์ ๊ณณ๊ณณ์ ์ ์ฉ์ํค๋ฉด ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด ์ด๋ค ๋ฌธ์ฅ์์ Javascript๋ผ๋ ๋จ์ด์๋ง ์ด class๋ฅผ ์ ์ฉ์์ผ์ ๋ณผ๋์ฒด๋ก ๋ง๋ค๊ณ ์ถ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ฐ๋ฉด ๋ฉ๋๋ค.
<span class="js">Javascript</span> is wonderful!
์ด๋ ๊ฒ ํ๋ฉด ์ด์ js๋ผ๋ class๋ฅผ ๊ฐ์ง ๋ชจ๋ ํ๊ทธ๋ฅผ ํ ๋ฒ์ ๋ฐ๊ฟ ์ ์์ต๋๋ค. style ํ๊ทธ ์์ ์๋ .js๋ง ์์ ํ๋ฉด ๋ชจ๋ ๋ถ๋ถ์ ํ ๋ฒ์ ๋ฐ๊ฟ ์ ์๋ ๊ฒ์ด์ฃ .
์๊ฐํด๋ณด๊ธฐ
-
js class์ ๋ค์ํ ์คํ์ผ์ ์ถ๊ฐํด์ Javascript๋ผ๋ ๊ธ์๋ฅผ ๊พธ๋ฉฐ๋ด ์๋ค.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.js {
background-color: gray;
color: white;
font-size: 50px;
}
</style>
</head>
<body>
<p class='js'>boostcousrse</p>
</body>
</html>
11. CSS๊ธฐ์ด(์ ํ์)
https://www.boostcourse.org/cs124/lecture/194593
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์ ํ์
์ ํ์์๋ ์ ๋ฒ ๊ฐ์์์ ๋ฐฐ์ด class ์ธ์๋ id๊ฐ ์กด์ฌํฉ๋๋ค. ์ ๋ฒ ๊ฐ์์์ class์ ๋ํ ์คํ์ผ์ ์ง์ ํ ๋ ๋ค์๊ณผ ๊ฐ์ ์ฝ๋๋ฅผ <head> ํ๊ทธ ์์ ๋ฃ์ด์ฃผ์์ฃ .
<style>
.js {
color: red;
}
</style>
id๋ class์๋ ๋ฌ๋ฆฌ .๋์ #์ ๋ถ์ฌ์ผ ํ๋ค๋ ์ฐจ์ด์ ์ด ์์ต๋๋ค. ์๋ฅผ ๋ค์ด์ first๋ผ๋ id๋ฅผ ๋ง๋ค ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ํ๋ด๋ ๊ฒ์ด์ฃ .
<style>
#first {
color: green;
}
</style>
๊ทธ๋ ๋ค๋ฉด ๋ง์ฝ class์ id๊ฐ ๋ชจ๋ ์ง์ ๋์ด ์๋ ํ๊ทธ์์๋, ๋ ์ค์ ์ด๋ค ๋์์ธ์ ๋ฐ๋ผ๊ฐ๊ฒ ๋ ๊น์? ์ด๋ฅผ ์ํด์ class์ id์ ์ฐจ์ด์ ์ ์์๋ด ์๋ค.
class๋ผ๋ ๋จ์ด๋ ๊ทธ๋ฃน์ ์๋ฏธํ๊ณ , id๋ ํน์ ํ ๊ฒ์ ์๋ณํ๋ค๋ ์๋ฏธ์ ๋๋ค. class ์ ํ์๋ ๊ฐ์ ์คํ์ผ์ด ์ง์ ๋ ๊ทธ๋ฃน์ ์๋ฏธํ๋ ๊ฒ์ด๊ณ , id๋ ํน์ ํ ํ๊ทธ์๋ง ์ง์ ํ๊ณ ์ถ์ ์คํ์ผ์ ๋ํ๋ด๋ ๊ฒ์ ๋๋ค. ๊ทธ๋์ class๋ ์ค๋ณต๋ ์ ์์ง๋ง, id๋ ํ ํ์ด์ง์์๋ ๋ฑ ํ๋ฒ๋ง ์ฐ์ด๊ฒ ๋๋ ๊ฒ์ ๋๋ค.
์ฆ, class ์ ํ์๊ฐ id ์ ํ์์ ๋นํด์ ๋ ํฌ๊ด์ ์ ๋๋ค. class ์ ํ์๋ฅผ ์ด์ฉํ๋ฉด ๊ด๋ฒ์ํ ํจ๊ณผ๋ฅผ ์ค ์ ์๊ณ , id ์ ํ์๋ฅผ ์ด์ฉํ๋ฉด ์์ธ์ ์ผ๋ก ๋์์ธ์ ๋ฐ๊ฟ ์ ์๋ ๊ฒ์ด์ฃ . ๊ทธ๋ ๊ธฐ ๋๋ฌธ์ class ์์ id๋ฅผ ์น์ด์ ๊ตฌํํ๋ ๊ฒ์ด ํจ์จ์ ์ ๋๋ค.
์ ํ์์ ์ฐ์ ์์
๋ง์ง๋ง์ผ๋ก id ์ ํ์์ class ์ ํ์ ์ธ์ ์คํ์ผ์ ๋ํ๋ด๋ ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ ๋ ์์๋ด ์๋ค. ๋ง์ฝ ์์ .๊ณผ # ๋ชจ๋ ์ง์ ํ์ง ์์ผ๋ฉด ๊ทธ๊ฒ์ ํ๊ทธ ์ด๋ฆ์ ์๋ฏธํฉ๋๋ค. ์ฆ ์๋์ ๊ฐ์ ์ฝ๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ด ํ์ด์ง์์ span์ด๋ผ๋ ์ด๋ฆ์ ํ๊ทธ๋ ๋ชจ๋ ๋์์ธ์ด ๋ฐ๋๋ ๊ฒ์ ๋๋ค.
id > class > ํ๊ทธ ์์๋ก ์ฐ์ ์์๋ฅผ ๊ฐ์ง๊ฒ ๋ฉ๋๋ค.
์๊ฐํด๋ณด๊ธฐ
1) ๋ค์๊ณผ ๊ฐ์ ์ฝ๋๊ฐ ์์ ๋, Javascript๋ผ๋ ๊ธ์์๋ ์ด๋ค ์๊น์ด ๋ํ๋ ๊น์? ๊ธ์์ ํฌ๊ธฐ๋ ์ผ๋ง๊ฐ ๋ ๊น์?
<style>
span {
color: blue;
}
.hello {
font-size: 12px;
color: red;
}
#bye {
font-size: 13px;
}
</style>
<span id="bye" class="hello">Javascript</span>
๊ฒฐ๊ณผ๋ฅผ ๋ณด์๋ฉด ํด๋์ค์ css ์ฝ๋์์๊ณผ id์ ํฐํธ๊ฐ ์์ ๋ ๊ฒ์ ์ ์ ์์ต๋๋ค.
id > class > ํ๊ทธ ์์๋ก ์ฐ์ ์์๋ฅผ ๊ฐ์ง๊ฒ ๋๋ค๊ณ ์ด์ผ๊ธฐ ๋๋ ธ์ต๋๋ค.
๊ทธ๋ ๊ธฐ ๋๋ฌธ์ 13px ์ด ์ ์ฉ๋๊ณ class ์ color ์ ๊ฐ์ด ์ ์ฉ๋๊ณ 12px์ id๊ฐ ์ฐ์ ์์๊ฐ ๋๊ธฐ ๋๋ฌธ์ ์ ์ฉ๋์ง ์์์ต๋๋ค.
span ํ๊ทธ๋ฅผ ๊ฐ๋ฆฌํค๋ css ์ฝ๋๋ hello ํด๋์ค๊ฐ ์ฐ์ ์์๊ฐ ๋ ๋๊ธฐ ๋๋ฌธ์ blue๊ฐ ์ ์ฉ๋์ง ์์์์ ์ ์ ์์ต๋๋ค.
12. ์ ์ดํ ํ๊ทธ ์ ํํ๊ธฐ
https://www.boostcourse.org/cs124/lecture/194594
์๋ฐ์คํฌ๋ฆฝํธ์ ์์
๋ถ์คํธ์ฝ์ค ๋ฌด๋ฃ ๊ฐ์
www.boostcourse.org
์ค๋์ ์์ ๋ฅผ ํ๋ฒ ๊ฐ์ด ์ฐพ์๋ณด๋ ์๊ฐ์ ๋๋ค.
javascript select by css selector์ ๊ด๋ จ์ ์ฌ๊ธฐ์ ์ฐพ์๋ณด์๋ฉด ๋ฉ๋๋ค.
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
Document.querySelector() - Web APIs | MDN
The Document method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned. Note: The matching is done using depth-first pre-order traversal of the
developer.mozilla.org
javascript style background color
https://www.w3schools.com/jsref/prop_style_backgroundcolor.asp
HTML DOM Style backgroundColor Property
Style backgroundColor Property โฎ Style Object Example Set a background color for a document: document.body.style.backgroundColor = "red"; Try it Yourself » More "Try it Yourself" examples below. Definition and Usage The backgroundColor property sets or
www.w3schools.com
์ ๊ฐ ๋ง๋ค์ด ๋ณธ ์์ ์ฝ๋๋ ์๋์ ๊ฐ์ต๋๋ค. night ๋ฒํผ์ ๋๋ฅด๋ฉด ๋์ดํธ ๋ชจ๋๋ก ๋ฐ๋์ด ๋ฐฐ๊ฒฝ์์ ๊ฒ์ , ๊ธ์์์ ํฐ์์ผ๋ก ๋ฐ๋๋๋ค.
๊ทธ๋ฆฌ๊ณ day ๋ฒํผ์ ๋๋ฅด๋ฉด ๋ค์ ๊ธฐ์กด์ ๋ฐฐ๊ฒฝ์๊ณผ ๊ธ์์์ธ ํฐ์๊ณผ ๊ฒ์ ์์ผ๋ก ๋ฐ๋๋ ํ๋ฉด์ ๋๋ค.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WEB1 - javaScript</title>
</head>
<body style="">
<h1><a href="index.html">WEB</a></h1>
<input type="button" value="night" onclick="
document.querySelector('body').style.backgroundColor = 'black';
document.querySelector('body').style.color = 'white';
">
<input type="button" value="day" onclick="
document.querySelector('body').style.backgroundColor = 'white';
document.querySelector('body').style.color = 'black';
">
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html">CSS</a></li>
<li><a href="3.html">JAVASCRIPT</a></li>
</ol>
<h2>JavaScript</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sapiente officia incidunt quas reprehenderit alias
eveniet necessitatibus eligendi harum obcaecati temporibus, odit, dolor nulla adipisci tempore illum suscipit
quod voluptatibus debitis quam atque nemo accusantium voluptatum voluptates voluptas. Laudantium labore,
praesentium architecto perspiciatis enim totam! Magni fugit corporis iste ratione dolorem temporibus. Magni
perferendis aspernatur mollitia! Eaque dolorem, exercitationem corrupti amet aliquid quis ab eligendi. Nam odio
maxime quae explicabo repellat velit error fuga dolores quo quia. Quidem beatae iusto dolore eos, consequatur
fuga magnam! Sed esse asperiores dolor et adipisci corrupti eveniet tempore deleniti rerum possimus natus,
reiciendis accusantium ut reprehenderit! Animi quaerat ratione, facere saepe iusto eos, obcaecati, provident
ius doloribus nam! Modi, hic! Est vel ipsam laborum placeat! Non nulla dolorum autem corrupti.
</p>
</body>
</html>
๋ค์ด๋ฒ ์ปค๋ฅํธ ๋ถ์คํฐ์ฝ์ค 3๊ธฐ ์ํฌํฐ์ฆ ํ๋ธ๐ฟ
hhhminme - Overview
๊พธ์คํ ๊ณต๋ถ์ค์ธ ์ด๋ณด ๊ฐ๋ฐ์์ง๋ง์ hub@kakao.com. hhhminme has 13 repositories available. Follow their code on GitHub.
github.com
๋ค ํจ๊ป ๋ฐฐ์ฐ๊ณ ์ฑ์ฅํ๋ ๋ถ์คํธ์ฝ์ค
๋ถ์คํธ์ฝ์ค(boostcourse)๋ ๋ชจ๋ ํจ๊ป ๋ฐฐ์ฐ๊ณ ์ฑ์ฅํ๋ ๋น์๋ฆฌ SW ์จ๋ผ์ธ ํ๋ซํผ์ ๋๋ค.
www.boostcourse.org