action
: 데이터를 주고받는 경로 입력method
: 데이터를 주고받는 방식 입력<fieldset>
= 그룹핑, 테두리가 만들어진다. <legend>
= 그룹의 제목 <body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
--- 코드 입력 ---
</fieldset>
</form>
</body>
사용자 입력이 실제로 이루어지는 곳
보통 <form>
태그 안에서 쓰여진다.
type=""
text
= 한줄 입력상자 (아이디, 이름)
password
= 비밀번호 입력상자 (비밀번호, 주민등록번호 뒷자리)
radio
= 단일 선택상자 (성별, 동의/동의안함)
checkbox
= 다중 선택상자
file
= 첨부파일 상자
image
= 이미지 첨부
submit
= 전송버튼 (보통 a를 많이 대체해서 쓴다.)
reset
= 초기화, 취소 버튼 (a로 대체)
button
= <button>
태그와 같이 어디서든 쓰일 수 있는 범용버튼
hidden
= 사용자에게 보이지 않는 입력폼 (데이터 전송이 목적이므로, 개발자가 사용한다.)
👇 이 외, 날짜 및 시간 등 유용한 type은 코드로 확인 !
<body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
<input type="text" maxlength="8" value="아이디를 입력하세요.">
<input type="password">
<input type="radio" name="sex">남자
<input type="radio" name="sex">여자
<input type="checkbox"> 1
<input type="checkbox"> 2
<input type="checkbox"> 3
<input type="file">
<input type="image" src="/images/image1.png" alt="대체텍스트">
<input type="submit" value="파일전송">
<input type="reset" value="취소">
<input type="button" value="일반버튼">
<input type="hidden">
<input type="date">
<input type="datetime-local">
<input type="month">
<input type="time">
<input type="email">
<!-- 모바일 : 이메일 키보드 생성 -->
<input type="number">
<!-- 모바일 : 숫자 키보드 생성 -->
<input type="search">
<!-- 안드로이드 : 돋보기 , IOS : return 버튼생성 -->
<input type="tell">
<!-- 전화번호 키패드 호출 -->
<input type="url">
<!-- www.(안드로이드) / .com 키패드 제공 -->
</fieldset>
</form>
</body>
rows=""
= 엔터 수cols=""
= 글자 수 (정확하지 않음)<body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
<textarea rows="" cols="">직접 입력하세요.</textarea>
</fieldset>
</form>
</body>
multiple
= 여러개 선택 가능 optgroup
= 그룹핑 option
= 선택목록 <body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
<select multiple>
<optgroup label="서울">
<option>강서</option>
<option>강북</option>
<option>강남</option>
</optgroup>
<optgroup label="경기도">
<option>부천</option>
<option>인천</option>
<option>광주</option>
</optgroup>
</select>
</fieldset>
</form>
</body>
<input type="radio">
와 함께 쓰일 때 !id
와 label 태그의 for
속성 내용을 동일하게 작성하여 서로 연결해준다.<body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
<input type="radio" name="sex" id="man"><label for="man">남자</label>
<input type="radio" name="sex" id="woman"><label for="woman">여자</label>
</fieldset>
</form>
</body>
<body>
<form action="" method="">
<fieldset>
<legend> 제목 </legend>
<label for="phone">핸드폰번호</label>
<select id="phone">
<option>010</option>
<option>016</option>
<option>017</option>
</select>
-
<input type="text" title="핸드폰 두번째자리">
-
<input type="text" title="핸드폰 세번째자리">
</fieldset>
</form>
</body>