교육 6일차 강의

구성본·2022년 3월 24일
post-thumbnail

1.학습한 내용

오늘도 Javascrpit!

1)두개의 버튼을 하나로(오늘의 핵심)

input type="button" value="night"button" value="day"button" value="night"2-백그라운드-배경-설정">2) 백그라운드 배경 설정

style
body{
background-image:url(https://picsum.photos/1024);
background-size:cover;
/style

-기본적인 백그라운드 배경 설정
원하는 다른 이미지를 설정할 수 있으며 사이즈를 바꿀 수 있다.

-여기서 style.css 라는 시트를 생성, 보낸 후 본문에 스타일 코드 지우고
link rel="stylesheet" href="style.css" 사용하면 백그라운드 적용

-현재 배경은 선생님이 알려주신 사이트에서 랜덤으로 결정되는 여러 사진이 나오는건데 개인적으로 마음에 들어서 적용중입니다.

3) Boolean, conditionalstatements

-참과 거짓을 0과 1의 방식으로 나타내는 것을 boolean이라고 한다.

console.log(1>1);
console.log(1===1); 엄격히 같은
console.log(1==1); 대충 같은
console.log(1!==1); 부정

-조건문(conditionalstatements)
if(조건){조건이 참이라면 나올 값}

4) 로그인 기능

body
script
let input_id=prompt('ID?');
if(input_id==='본'){
alert(input_id+'님 안녕하세요^^');
} else {
alert(input_id+'누구세요?');
}
/script
/body
-prompt를 통해 id확인 및 그 조건에 따른 여러가지 말들을 설정 가능

a id="a1" href="index.html"
a id="a2" href="1.html"
a id="a3" href="2.html"
a id="a4" href="3.html"
document.querySelector('#a1').style.color='black';
document.querySelector('#a2').style.color='black';
document.querySelector('#a3').style.color='black';
document.querySelector('#a4').style.color='black';

-id='a'태그와 if else 조건문을 통해 버튼눌러 태그 글자색 바꾸기 가능

5) Loof

-배열(Array)과 정리
var topic1='1'
var memver1='a'
var topic2='2'
var memver2='b'
var topic3='3'
var memver3='c'
정리하면
var topics=['1','2','3']
var topics=['a','b','c']

-반복문(Loof)
console.log(1);
for(①let i=0;②i<2 ;③i=i+1){
console.log(2);
console.log(3);
}
console.log(4);

for=약속문
①최초 한번만 실행
②계속 할지 말지를 결정하는 boolean
③증감조건

-Array + Loof
topics=['1','2','3'];
for(let i=0; i<topics.length; i=i+1){
document.write('<li코드>'+topics[i]+'</li코드>');
}
topics.length = 원소 개수를 세어주고 document.writr와 li코드를 통해 topics를 웹에 목록으로 표시

2.학습내용 중 어려웠던 점
여러가지 내용들이 많아지면서 따라가는건 어떻게든 따라가지만 응용하는 부분은 정말 많이 모자란 것 같습니다.

3.해결방법
일단은 아직은 따라가기 바쁜 부분이 있어서 최대한 숙달하며 하나 씩 해나가야겠습니다.

4.학습소감
점점 알아가야 할 것들이 많아지지만 그만큼 재미있는 부분들도 하나씩 보이는것 같아 의욕이 생깁니다.

현재 진행 상황
https://devil66v.github.io/daegu-ai-school-web/

profile
코딩공부중

0개의 댓글