INPUT
 
FORM 안에 들어가는 element로 1줄 텍스트 입력란, 암호 입력란, 체크상자, 라디오단추 등의 컨트롤을 만들 수 있도록 한다. 시작 태그만 있다.

<form>
이름 : <input type=text size=12 name=user value=마시마로>
암호 : <input type=password size=12 name=passwd>
</form>

+ 실행결과


이름 :
암호 :


<form>
국적
<input type=checkbox checked name=nationality value=1> 한국인
<input type=checkbox name=nationality value=2> 미국인
<input type=checkbox name=nationality value=3> 중국인
</form>

+ 실행결과


국적
한국인
미국인
중국인

<form>
나이
<input type=radio name=age value=answer1 checked> 12세 이하
<input type=radio name=age value=answer2> 13-17세
<input type=radio name=age value=answer3> 18-25세
<input type=radio name=age value=answer4> 26-35세
<input type=radio name=age value=answer5> 36세 이상
</form>

+ 실행결과


나이
12세 이하
13-17세
18-25세
26-35세
36세 이상


<form>
파일을 올려주세요. <input type=file name=photo size=20 accept="image/*">
</form>



<form>
파일을 올려주세요. <input type=file name=photo size=20 accept="image/*">
</form>

+ 실행결과


파일을 올려주세요.


<form>
<input type=submit value="다 됐어요"> <input type=reset value="다시 할래요">
</form>

+ 실행결과





<form>
<input type=image name=point src="images/confirm_btn.gif" border=0>
</form>

+ 실행결과

type = text | password | checkbox | radio | submit | reset | file | hidden | image | button

컨트롤의 종류를 정한다. 기본값은 text이다.
  • text
    password : text와 비슷하지만, 입력하는 문자가 모두 *로 표시된다.
    checkbox
    radio
    submit, reset, button
    file
    hidden
    image : Submit 단추 대신 그림을 사용할 수 있도록 해 준다. Src 속성으로 그림 파일의 경로를 지정한다. IMG와 마찬가지로 alt 속성을 이용해 문자열 설명을 붙일 수 있다.

name = 문자열

컨트롤에 이름을 부여한다. Type의 값이 checkbox나 radio일 때는 각각의 name은 같게 하고, value를 다르게 한다.

value = 문자열

컨트롤의 초기값이다.

size = 숫자

컨트롤의 폭을 정한다. 단위는 픽셀이다. 다만, type이 text나 password일 때는 입력하는 문자의 수이다.

maxlength = 숫자

Type이 text나 password일 때, 사용자가 입력할 수 있는 최대 문자 수를 말한다. Size의 값보다 클 수도 있다.

checked

Type이 checkbox나 radio일 때, checked 속성이 있으면 이미 선택된 상태로 나타난다.

src = "URL"

Type이 image일 때, 단추로 사용될 그림 파일의 경로이다.

readonly

컨트롤이 읽기 전용이 되어 변경되지 않는다.

disabled

사용자 입력을 못하도록 한다. Disabled 컨트롤들은 tabindex를 갖지 않는다.

tabindex = 숫자

탭 키를 이용해 컨트롤의 포커스를 옮길 때, 그 순서를 정한다.