<INPUT>
FORM 안에 들어가는 element로 1줄 텍스트 입력란, 암호 입력란, 체크상자, 라디오단추 등의
컨트롤을 만들 수 있도록 한다. 시작 태그만 있다.
버튼을 클릭하여 특정 페이지 찾아가기 <INPUT type="button" value="특정으로" onclick='document.location="특정.htm"'> <form> 이름: <INPUT type=text size=12 name=user value=이정> <BR> 암호: <INPUT type=password size=12 name=passwd></form> <form> 국적 <BR> <INPUT type=checkbox checked name=nationality value=1> 한국인 <BR> <INPUT type=checkbox name=nationality value=2> 미국인 <BR> <INPUT type=checkbox name=nationality value=3> 중국인 </form> <form> 나이 <BR> <INPUT type=radio name=age value=answer1 checked> 12세 이하 <BR> <INPUT type=radio name=age value=answer2> 13-17세 <BR> <INPUT type=radio name=age value=answer3> 18-25세 <BR> <INPUT type=radio name=age value=answer4> 26-35세 <BR> <INPUT type=radio name=age value=answer5> 36세 이상 </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=button name=point value='★' border=0> </form> <DIV align=center> <P>INPUT 예 7 <P><form name=love> <INPUT STYLE=color:red;background:white type=text name=sex size=15> <INPUT STYLE=cursor:hand type=button value='확 인' onClick='Ls()' onfocus=blur()> </form> <P><form> <INPUT STYLE=color:brown;background:white type=text name=pass size=15> <INPUT STYLE=cursor:hand type=reset value='Reset' onfocus=blur()> </form> <P><form> <INPUT STYLE=cursor:hand type=button value='새로고침' onClick=location.reload() onfocus=blur()> </form> <P><form> <INPUT STYLE=cursor:hand type=button value='소스보기' onClick='window.location="view-source:"+window.location.href' onfocus=blur()> </form> <P><INPUT STYLE=cursor:hand type=button value='문서닫기' onClick='self.close()' onfocus=blur()> </DIV>
속성
type = text | password | checkbox | radio | submit | reset | file | hidden | image | button
컨트롤의 종류를 정한다. 기본값은 text이다.
password: text와 비슷하지만, 입력하는 문자가 모두 *로 표시된다.
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 = 숫자
탭 키를 이용해 컨트롤의 포커스를 옮길 때, 그 순서를 정한다.