• 회원가입
  • 로그인
  • 구글아이디로 로그인

[attribute] HTML - form 속성 - 해당 요소가 속하는 폼요소 지정 (= form속성 = 폼속성) ※ 폼 밖에 위치 시, 폼소속 지정

목차
  1. form 예제 - <button> 경우
  2. form 정의
  3. form 구문
  4. form 예제 - <fieldset> 경우
  5. form 예제 - <input> 경우
  6. form 예제 - <label> 경우
  7. form 예제 - <meter> 경우
  8. form 예제 - <object> 경우
  9. form 예제 - <output> 경우
  10. form 예제 - <select> 경우
  11. form 예제 - <textarea> 경우

 

form 예제 - <button> 경우

 

<form action="/action_page.php" method="get" id="hz">

  <label for="name">이름:</label>

  <input type="text" id="name" name="name"><br><br>

  <label for="nick">별명:</label>

  <input type="text" id="nick" name="nick">

</form>


<button type="submit" form="hz" value="확인">확인</button>

 

결과보기

 

form 정의

 

해당 요소가 속하는 form 요소 지정.

 


 

1.

form 속성의 값은 같은 문서 안 <form> 요소의 id와 일치해야 함.

 

2. form 속성 사용 가능 태그 종류

<button>, <fieldset>, <input>, <label>, <meter>, <object>, <output>, <select>, <textarea>

 

3.

주요 최신 브라우저 모두 지원. 

단, <meter>, <object>, <output> 요소는 아직 지원 브라우저 없음.

 

 

form 구문

 

  • <button form="form_id">
  • <fieldset form="form_id">
  • <input form="form_id">
  • <label form="form_id">
  • <meter form="form_id">
  • <object form="form_id">
  • <output form="form_id">
  • <select form="form_id">
  • <textarea form="form_id">

 


[속성값]

 

form_id

해당 요소가 속하는 폼 요소의 id 속성값

 

 

form 예제 - <fieldset> 경우

 

<form action="/action_page.php" method="get" id="hz">

  <label for="lang">좋아하는 코딩언어?</label>

  <input type="text" id="lang" name="lang">

  <input type="submit">

</form>


<fieldset form="hz">

  <legend>이름/별명:</legend>

  <label for="name">이름:</label>

  <input type="text" id="name" name="name" form="hz"><br><br>

  <label for="nick">별명:</label>

  <input type="text" id="nick" name="nick" form="hz">

</fieldset>

 

결과보기

 

form 예제 - <input> 경우

 

<form action="/action_page.php" id="hz">

  <label for="name">이름:</label>

  <input type="text" id="name" name="name"><br><br>

  <input type="submit" value="확인">

</form>


<label for="nick">별명:</label>

<input type="text" id="nick" name="nick" form="hz">

 

결과보기

 

form 예제 - <label> 경우

 

<form action="/action_page.php" id="hz">

  <input type="radio" id="html" name="lang" value="HTML"><br>

  <input type="radio" id="css" name="lang" value="CSS">

  <label for="css">CSS</label><br>

  <input type="radio" id="javascript" name="lang" value="JavaScript">

  <label for="javascript">JavaScript</label><br><br>

  <input type="submit" value="확인">

</form>


<label form="hz" for="html">HTML</label>

 

결과보기

 

form 예제 - <meter> 경우

 

<form action="/action_page.php" method="get" id="hz">

이름: <input type="text" name="name"><br>

<input type="submit" value="확인">

</form>


<p><label for="score">평점:</label>

<meter id="score" form="hz" name="score" min="0" low="40" high="90" max="100" value="95"></meter></p>


 

form 예제 - <object> 경우

 

<form action="/action_page.php" id="hz">

이름: <input type="text" name="name"><br>

<input type="submit" value="확인">

</form>


<object form="hz" data="homzzang.jpg" width="300" height="200"></object>


 

form 예제 - <output> 경우

 

<form action="/action_page.php" id="hz" oninput="x.value=parseInt(a.value)+parseInt(b.value)">

<input type="range" id="a" name="a" value="50">

+ <input type="number" id="b" name="b" value="25">

<br><br>

<input type="submit">

</form>


<output form="hz" id="x" name="x" for="a b"></output>

 

결과보기

 

form 예제 - <select> 경우

 

<form action="/action_page.php" id="hz">

  <label for="name">이름:</label>

  <input type="text" id="name" name="name">

  <input type="submit" value="확인">

</form>


<label for="lang">언어 선택:</label>

<select id="lang" name="lang" form="hz">

  <option value="html">HTML</option>

  <option value="css">CSS</option>

  <option value="js">JS</option>

</select>

 

결과보기

 

form 예제 - <textarea> 경우

 

<form action="/action_page.php" id="hz">

  이름: <input type="text" name="name">

  <input type="확인">

</form>

<br>

<textarea rows="4" cols="50" name="comment" form="hz">

자기소개 입력</textarea>


결과보기



분류 제목
attribute HTML - onplaying 속성 - (오디오/비디오) 재생 중 실행 (= onplaying속성 = 온플레…
attribute HTML - title 속성 ★ - 요소애 대한 추가 정보 지정 (= title속성 = 타이틀속성)
attribute HTML - onsubmit 속성 ★ - 폼데이터 제출 시 실행 (= onsubmit속성 = 온서브미트속성/…
attribute HTML - enctype 속성 - 폼데이터 인코딩방식 지정 (= enctype속성 = 인크타입속성/잉크타입…
attribute HTML - ondragleave 속성 - 드래그 한 요소가 드롭박스 이탈 시 실행 (= ondragleav…
form HTML - <input type="radio"> 태그 - 오직 1개의 요소만 선택 (= 인풋라디오타입/라디…
attribute HTML - ononline 속성 - 브라우저가 온라인으로 작동할 때 실행 (= ononline속성 = 온온…
attribute HTML - onseeked 속성 - (오디오/비디오) 재생위치 변경 종료 시, 실행할 코드 지정. (= o…
attribute HTML - src 속성 ★ - 외부 리소스 URL주소 지정 (= src속성 = 에스알시속성/에스알씨속성/소…
attribute HTML - cellspacing 속성 - 테이블셀간의 간격 지정 (= cellspacing속성 = 셀스페이…
attribute HTML - onemptied 속성 - 미디어 소스가 비어있거나 삭제된 경우에 실행 (= onemptied속…
attribute HTML - onabort 속성 - 미디어 파일 로드 중단 이벤트 발생 시 실행할 코드 정의 (= onabo…
attribute HTML - srclang 속성 - 트랙태그 소스의 언어코드 지정 (= srclang속성 = 에스알시랭속성/…
attribute HTML - form 속성 - 해당 요소가 속하는 폼요소 지정 (= form속성 = 폼속성) ※ 폼 밖에 위…
attribute HTML - onpageshow 속성 - 사용자가 웹페이지 탐색 시 실행 (= onpageshow속성 = 온…
form HTML - <input type="hidden"> 태그 - 숨겨진 입력 필드 지정 (= 사용자 몰래 입력값…
attribute HTML - label 속성 - 요소에 대한 꼬리표 지정 (= label속성 = 레이블속성/라벨속성)
attribute HTML - headers 속성 - 관련된 헤더셀ID 목록 지정 (= headers속성 = 헤더스속성/헤더즈…
attribute HTML - onstalled 속성 - (오디오/비디오) 이용불가 (=사용불가) 시 실행 (= onstall…
attribute HTML - rel 속성 ★ - 링크문서가 현재문서와 어떤 관계인지 지정 (= rel속성 = 릴속성/렐속성)
2/18
목록
찾아주셔서 감사합니다. Since 2012