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

[attribute] HTML - autofocus 속성 - 포커스 자동 여부 지정 (= autofocus속성 = 오토포커스속성)

목차
  1. autofocus 예제 - <input> 경우
  2. autofocus 정의
  3. autofocus 구문
  4. autofocus 예제 - <button> 경우
  5. autofocus 예제 - <select> 경우
  6. autofocus 예제 - <textarea> 경우

 

autofocus 예제 - <input> 경우

 

<form action="/action_page.php">

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

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

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

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

  <input type="submit">

</form>

 

 

autofocus 정의

 

페이지 로드 시, 해당 요소에 포커스 줄지 여부 지정하는 참거짓 속성.

 


 

1. autofocus 사용 가능 태그

<button>, <input>, <select>, <textarea>

 

2.

autofocus 속성 갖는 요소는 검고 굵은 테두리 갖음.

 

3.

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

단, Firefox 브라우저는 <select> 태그 지원 X

 

 

autofocus 구문

 

  • <button type="button" autofocus>
  • <input autofocus>
  • <select autofocus>
  • <textarea autofocus>

 


[속성값]

 

없음.

 

 

autofocus 예제 - <button> 경우

 

<button type="button" autofocus onclick="alert('홈짱닷컴 Homzzang.com')">클릭</button>

 

 

autofocus 예제 - <select> 경우

 

<form action="/action_page.php">

  <label for="hz">좋아하는 언어:</label>

  <select name="hz" id="hz" autofocus>

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

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

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

  </select>

  <br><br>

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

</form>

 

 

autofocus 예제 - <textarea> 경우

 

<textarea rows="3" cols="30" autofocus>

홈짱닷컴 Homzzang.com (홈페이지 제작관리 강의)

</textarea>

 

 


분류 제목
attribute HTML - onloadstart 속성 - 미디어 로드 시작 시 실행 (= onloadstart속성 = 온…
attribute HTML - onmousedown 속성 - 마우스버튼 내려갈 때 실행 (= onmousedown속성 = 온마…
attribute HTML - onmousemove 속성 ★ - 마우스커서가 지정요소 안으로 이동 시 실행 (= onmouse…
attribute HTML - onmouseout 속성 ★ - 마우스커서가 지정요소 밖으로 이동 시 실행 (= onmouseo…
attribute HTML - onmouseover 속성 ★ - 마우스커서가 지정요소 위에 있을 때 실행 (= onmouseo…
attribute HTML - onmouseup 속성 - 마우스버튼 올라갈 때 실행 (= onmouseup속성 = 온마우스업속…
attribute HTML - onmousewheel 속성 - (폐기예고) 마우스휠 움직일 때 실행 (= onmousewhe…
attribute HTML - onoffline 속성 - 브라우저가 오프라인으로 작동할 때 실행 (= onoffline속성 =…
attribute HTML - ononline 속성 - 브라우저가 온라인으로 작동할 때 실행 (= ononline속성 = 온온…
attribute HTML - onpagehide 속성 - 웹페이지가 숨겨질 때 실행 (= onpagehide속성 = 온페이지…
attribute HTML - onpageshow 속성 - 사용자가 웹페이지 탐색 시 실행 (= onpageshow속성 = 온…
attribute HTML - onpaste 속성 - 사용자가 요소에 내용 붙여넣기 시 실행 (= onpaste속성 = 온패스…
attribute HTML - onpause 속성 - (오디오/비디오) 일시정지 시 실행 (= onpause속성 = 온포스속성…
attribute HTML - onplay 속성 - (오디오/비디오) 재생 시 실행 (= onplay속성 = 온플레이속성) ※…
attribute HTML - onplaying 속성 - (오디오/비디오) 재생 중 실행 (= onplaying속성 = 온플레…
attribute HTML - onpopstate 속성 - 브라우저 히스토리 변경 시 실행 (= onpopstate속성 = 온…
attribute HTML - onprogress 속성 - (오디오/비디오) 다운로드 시 실행 (= onprogress속성 =…
attribute HTML - onratechange 속성 - (오디오/비디오) 재생속도 변경 시 실행 (= onratecha…
attribute HTML - onreset 속성 - 폼 초기화 시 실행 (= onreset속성 = 온리셋속성) ※ onres…
attribute HTML - onresize 속성 ★ - 브라우저창크기 변경 시 실행 (= onresize속성 = 온리사이즈…
6/9
목록
찾아주셔서 감사합니다. Since 2012