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

[HTML_Objects] JS - <button> 객체 ★ - 클릭버튼 (= button태그 = 버튼태그) (HTML5수정)

목차

  1. <button> 객체 정의 - 버튼
  2. <button> 객체 구문
  3. <button> 객체 예제 - 접근
  4. <button> 객체 예제 - 생성
  5. <button> 객체 속성

 

<button> 객체 정의 - 버튼

 

HTML <button> 태그(요소) 의미.

 

 

<button> 객체 구문

 

[접근]

var x = document.getElementById("요소ID");

 

[생성]

var x = document.createElement("BUTTON");

 

 

<button> 객체 예제 - 접근

 

<button type="button" id="hz" onclick="homzzang()">클릭</button>


<p id="demo"></p>


<script>

function homzzang() {

  var x = document.getElementById("hz");

  x.disabled = true;

}

</script>

 

결과보기 

 

<button> 객체 예제 - 생성

 

<button onclick="homzzang()">클릭</button>


<script>

function homzzang() {

  var x = document.createElement("BUTTON");

  var t = document.createTextNode("입장");

  x.appendChild(t);

  document.body.appendChild(x);

}

</script>

 

결과보기 

 

<button> 객체 속성

 

autofocus

페이지가 로드될 때 버튼이 자동으로 focus 가져야하는지 여부 설정/반환.

 

disabled

버튼의 비활성화 여부 설정/반환.

 

form

버튼이 포함된 폼에 대한 참조 반환.

 

formAction

버튼의 formaction 속성값 설정/반환.

 

formEnctype

버튼의 formenctype 속성값 설정/반환.

 

formMethod

버튼의 formmethod 속성값 설정/반환.

 

formNoValidate

제출시 양식 데이터의 유효성을 검사할지 여부를 설정/반환.

 

formTarget

버튼의 formtarget 속성값 설정/반환.

 

name

버튼의 name 속성값 설정/반환.

 

type

버튼의 타입 설정/반환.

 

value

버튼의 value 속성값 설정/반환.

 

※ <button> 객체는 표준 속성/메서드/이벤트 지원.

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
게시물이 없습니다.
목록
찾아주셔서 감사합니다. Since 2012