Stack/HTML

[HTML] 5일 만에 끝내는 HTML 기초 3일차

7ingout 2022. 3. 16. 15:15

1. 비디오태그

https://www.youtube.com/shorts/Y6Pbqbg4IpQ

<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8"/>
	</head>
	<body>
		<video src="dog.mp4" width="500" controls autoplay muted/>   
		<!-- controls: 재생 버튼 같은거, 브라우저 정책상 꼭 muted(음소거) 넣어야 autoplay 됨-->
		</video>
	</body>
</html>

 

 

 

2. 비디오태그 (이 양식을 더 많이 쓸 것 !)

<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8"/>
	</head>
	<body>
		<video controls autoplay muted loop width="500">   
			<source src="dog.mp4" type="video/mp4" />
			이 브라우저는 비디오태그를 지원하지 않습니다.
		</video>
	</body>
</html>

 

 

 

3. 폼태그

<form action="서버경로" method="get/post">

        </input type="text" name="userid" >
</form>

* input태그 속성

 

type 속성: 입력필드 타입을 지정함

type

1. text: 텍스트를 입력하는 창을 생성

2. password: 비밀번호를 입력하는 창을 생성

3. radio: 라디오 버튼을 생성

4. checkbox: 체크박스를 생성

5. hidden: 사용자에게 보이지는 않지만 서버로 전송됨

6. submit: 서버로 제출/전송하는 버튼을 생성

7. reset: 입력필드를 초기화 시키는 버튼을 생성

8. file: 파일 이름을 입력하는 창을 생성

 

name 속성: 서버로 전달되는 이름

value 속성: 입력태그의 초기값
placeholder 속성: 사용자가 값을 입력하기 전에 힌트가 입력필드에 표시됨
required 속성: 폼을 제출하기 전에 입력필드가 작성되어야 함을 지정함

disabled 속성: 입력필드가 사용불가임을 지정함

 

폼태그 학습

필수 입력사항

아이디 :

비밀번호 :

성별: 남자 여자

선택 입력사항

취미: 독서 게임

좋아하는 색상:

숫자:

 

<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8"/>
	</head>
	<body>
		<!--
			input 태그
			type속성: 다양한 값을 입력받도록 함
			text/ password/ submit/ reset/ radio/ checkbox/ number/ color/ email

			fieldset 태그
			여러 컨트롤과 레이블을 묶을 때 사용
			legend 태그
			fieldset의 제목을 나타냄
			disabled 속성- 비활성화
		-->
		<h1>폼태그 학습</h1>
		<form action="join.php" method="get">
			<fieldset>
				<legend>필수 입력사항</legend>
				<p>아이디 : <input type="text" name="userId" /></p>
				<p>비밀번호 : <input type="password" name="userPass" /></p>
				<p>성별: <input type="radio" name="gender" value ="male" />남자
				<input type="radio" name="gender" value ="female" />여자
			</p>
			</fieldset>
			<fieldset disabled>
				<legend>선택 입력사항</legend>
				<p>취미:
				<input type="checkbox" name="hobby1" value="reading" />독서
				<input type="checkbox" name="hobby2" value="game"/> 게임
				</p>
				<p>좋아하는 색상:
				<input type="color" name="faColor" />
				</p>
				<p>
				숫자:
				<input type="number" name="faNumber" min="1" max="10" />
				</p>
			</fieldset>
			<p>
				<input type="submit" value="확인" />
				<input type="reset" value="취소" />
			</p>
		</form>
	</body>
</html>

 

 

 

4. 폼의 그룹화 실습

폼의 그룹화

필수 입력사항

이름

비밀번호

추가 입력사항

이메일주소

<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8"/>
	</head>
	<body>
		<h1>폼의 그룹화</h1>
		<form action="join.php" method="get">
			<fieldset>
				<legend>필수 입력사항</legend>
				<p>이름 <input type="text" name="userName" /></p>
				<p>비밀번호 <input type="password" name="userPass" /></p>
			</fieldset>
			<fieldset>
				<legend>추가 입력사항</legend>
				<p>이메일주소 <input type="text" name="userEmail" /></p>
			</fieldset>
	</body>
</html>

 

 

 

5. select태그

if (!window.T) { window.T = {} } window.T.config = {"TOP_SSL_URL":"https://www.tistory.com","PREVIEW":false,"ROLE":"guest","PREV_PAGE":"","NEXT_PAGE":"","BLOG":{"id":5292937,"name":"7ingout","title":"Hello, 7ingout world!","isDormancy":false,"nickName":"7ingout","status":"open","profileStatus":"normal"},"NEED_COMMENT_LOGIN":false,"COMMENT_LOGIN_CONFIRM_MESSAGE":"","LOGIN_URL":"https://www.tistory.com/auth/login/?redirectUrl=https://7ingout.tistory.com/m/6","DEFAULT_URL":"https://7ingout.tistory.com","USER":{"name":null,"homepage":null,"id":0,"profileImage":null},"SUBSCRIPTION":{"status":"none","isConnected":false,"isPending":false,"isWait":false,"isProcessing":false,"isNone":true},"IS_LOGIN":false,"HAS_BLOG":false,"IS_SUPPORT":false,"IS_SCRAPABLE":false,"TOP_URL":"http://www.tistory.com","JOIN_URL":"https://www.tistory.com/member/join","PHASE":"prod","ROLE_GROUP":"visitor"}; window.T.entryInfo = {"entryId":6,"isAuthor":false,"categoryId":1030616,"categoryLabel":"Stack/HTML"}; window.appInfo = {"domain":"tistory.com","topUrl":"https://www.tistory.com","loginUrl":"https://www.tistory.com/auth/login","logoutUrl":"https://www.tistory.com/auth/logout"}; window.initData = {}; window.TistoryBlog = { basePath: "", url: "https://7ingout.tistory.com", tistoryUrl: "https://7ingout.tistory.com", manageUrl: "https://7ingout.tistory.com/manage", token: "WMFEjmQ3Uu2fC3GtDHHgMgvzUnAr/bEJOrTeO1POiCoAOXNEd3i68KSkwe+JRc+/" }; var servicePath = ""; var blogURL = "";window.T.gnbContext = {"userId":0,"userName":"","profileSrc":"https://t1.daumcdn.net/tistory_admin/blog/admin/profile_default_03.png","storyServiceURI":{"storyHome":"https://storyhome.kakao.com/","brunchStory":"https://brunch.co.kr/","kakaoStory":"https://story.kakao.com/"},"blogs":[],"tryAutoLogin":false};

select태그

<!DOCTYPE html>
<html lang="ko>
	<head>
		<meta charset="utf-8" />
	</head>
	<body>
		<h1>select태그</h1>
		<form action="join.php" method="get">
			<p>
				<select name="job">
					<option value="job1">선생님</option>
					<option value="job2">회사원</option>
					<option value="job3">학생</option>
				</select>
			</p>
			<p>
				<textarea cols="50" rows="20">
				</textarea>
			</p>
			<p>
				<input type="text" name="userName" placeholder="이름을 입력하세요"/>
			</p>
			<p>
				<input type="file" name="userFile"/>
			</p>
			<p>
				<input type="hidden" name="hid" value="hi"
			</p>
			<p>
				<input type="submit" value="확인" />
			</p>
		</form>
	</body>
</html>

 

 

 

6. 폼태그 실습

if (!window.T) { window.T = {} } window.T.config = {"TOP_SSL_URL":"https://www.tistory.com","PREVIEW":false,"ROLE":"guest","PREV_PAGE":"","NEXT_PAGE":"","BLOG":{"id":5292937,"name":"7ingout","title":"Hello, 7ingout world!","isDormancy":false,"nickName":"7ingout","status":"open","profileStatus":"normal"},"NEED_COMMENT_LOGIN":false,"COMMENT_LOGIN_CONFIRM_MESSAGE":"","LOGIN_URL":"https://www.tistory.com/auth/login/?redirectUrl=https://7ingout.tistory.com/m/6","DEFAULT_URL":"https://7ingout.tistory.com","USER":{"name":null,"homepage":null,"id":0,"profileImage":null},"SUBSCRIPTION":{"status":"none","isConnected":false,"isPending":false,"isWait":false,"isProcessing":false,"isNone":true},"IS_LOGIN":false,"HAS_BLOG":false,"IS_SUPPORT":false,"IS_SCRAPABLE":false,"TOP_URL":"http://www.tistory.com","JOIN_URL":"https://www.tistory.com/member/join","PHASE":"prod","ROLE_GROUP":"visitor"}; window.T.entryInfo = {"entryId":6,"isAuthor":false,"categoryId":1030616,"categoryLabel":"Stack/HTML"}; window.appInfo = {"domain":"tistory.com","topUrl":"https://www.tistory.com","loginUrl":"https://www.tistory.com/auth/login","logoutUrl":"https://www.tistory.com/auth/logout"}; window.initData = {}; window.TistoryBlog = { basePath: "", url: "https://7ingout.tistory.com", tistoryUrl: "https://7ingout.tistory.com", manageUrl: "https://7ingout.tistory.com/manage", token: "WMFEjmQ3Uu2fC3GtDHHgMgvzUnAr/bEJOrTeO1POiCoAOXNEd3i68KSkwe+JRc+/" }; var servicePath = ""; var blogURL = "";window.T.gnbContext = {"userId":0,"userName":"","profileSrc":"https://t1.daumcdn.net/tistory_admin/blog/admin/profile_default_03.png","storyServiceURI":{"storyHome":"https://storyhome.kakao.com/","brunchStory":"https://brunch.co.kr/","kakaoStory":"https://story.kakao.com/"},"blogs":[],"tryAutoLogin":false}; 폼태그 실습

JOIN US회원가입

회원가입 폼
아이디
※영문자, 숫자, _만 입력가능, 최소 3자이상 입력하세요
패스워드
패스워드 확인
패스워드 분실시 답변
이름 (공백없이 한글만 입력가능)
별명 한글2글자, 영문4글자 이상 입력가능합니다.
공백없이 한글, 영문, 숫자만 입력가능 (한글 2자, 영문 4자이상)
별명을 바꾸시면 앞으로 60일 이내는 변경할 수 없습니다.
E-mail E-mail주소를 입력하십시오
성별 남자 여자
메일링 서비스 정보메일을 받겠습니다.
핸드폰 문자메세지 핸드폰 문자메세지를 받겠습니다.
<!DOCTYPE html>
<html lang ="ko>
	<head>
		<meta charset="utf-8" />
		<title>폼태그 실습</title>
	</head>
	<body>
		<h3>JOIN US회원가입</h3>
		<form action="join.php" method="get">
		<table border="1" cellpadding="15" cellspacing="0">
			<caption><strong>회원가입 폼</strong></caption>
			<tr>
				<th>아이디</th>   
				<td><input type="text" name="userId" required /></br>   <!-- required: 필수기입-->
				<strong>※영문자, 숫자, _만 입력가능, 최소 3자이상 입력하세요</strong></td>
			</tr>
			<tr>
				<th>패스워드</th>
				<td><input type="text" name="userPass" /></td>
			</tr>
			<tr>
				<th>패스워드 확인</th>
				<td><input type="text" name="userPCheck" /></td>
			</tr>
			<tr>
				<th>패스워드 분실시 답변</th>
				<td><input type="text" name="userPAnswer" /></td>
			</tr>			
			<tr>
				<th>이름 </th>
				<td><input type="text" name="userName" placeholder="이름을 입력하세요."/>
				<strong>(공백없이 한글만 입력가능)</strong></td>
			</tr>
			<tr>
				<th>별명</th>
				<td><input type="text" name="userNick" />
				<strong>한글2글자, 영문4글자 이상 입력가능합니다.</br>
				공백없이 한글, 영문, 숫자만 입력가능 (한글 2자, 영문 4자이상)</br>
				별명을 바꾸시면 앞으로 60일 이내는 변경할 수 없습니다.</strong></td>
			</tr>
			<tr>
				<th>E-mail</th>
				<td><input type="email" name="userEmail" />
				<strong>E-mail주소를 입력하십시오</strong></td>
			</tr>
			<tr>
				<th>성별</th>
				<td><input type="radio" name="gender" value ="male" />남자
				<input type="radio" name="gender" value ="female" />여자</td>
			</tr>
			<tr>
				<th>메일링 서비스</th>
				<td><input type="checkbox" name="MailingService" value="Mail" />
				<strong>정보메일을 받겠습니다.</strong></td>
			</tr>
			<tr>
				<th>핸드폰 문자메세지</th>
				<td><input type="checkbox" name="SMS" value="SMS" />
				<strong>핸드폰 문자메세지를 받겠습니다.</strong></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="확인" />
				<input type="reset" value="취소" /></td>
			</tr>
		</table>
		</form>
	</body>
</html>

 

테이블 안의 확인 취소 버튼은 눌러도 작동을 안한다 ...................... why

해결완료: form태그 기입 안했었음 허허 ...