<시간/> HTML DOM Button disabled 속성은 요소의 disabled 속성과 연결되어 있습니다. button disabled 속성은 주어진 버튼이 비활성화되었는지 여부를 설정하거나 반환하는 데 사용됩니다. 사용자가 더 이상 지정된 요소와 상호 작용할 수 없도록 버튼을 비활성화하는 데 사용됩니다. 비활성화된 속성을 설정하면 웹 브라우저에서 기본적으로 버튼이 회색으로 표시됩니다. 구문 다음은 −의 구문입니다. 비활성화된 속성 설정 - buttonObject.disabled = true|false 여기에서 true|false는 주어진 입력 버튼을 비활성화할지 여부를 지정합니다. 사실 - 버튼이 비활성화됩니다. 거짓 - 버튼은 비활성화되지 않습니다. 버튼 비활성화 속성의 예를 살펴보겠습니다 - 예시 <!DOCTYPE html> <html> <body> <button id="Button1">BUTTON</button> <p>Click the below button to disable the above button.</p> <button onclick="buttonDis()">CLICK IT</button> <p id="Sample"> <script> function buttonDis() { document.getElementById("Button1").disabled = true; var x=document.getElementById("Button1").disabled; document.getElementById("Sample").innerHTML = "Button disabled is "+x; } </script> </body> </html> 출력 이것은 다음과 같은 출력을 생성합니다 - CLICK IT 버튼을 클릭하면 - 위의 예에서 - id가 "Button1"인 버튼을 만들었으며 버튼은 기본적으로 활성화되어 있습니다. <button id="Button1">BUTTON</button> 그런 다음 클릭 시 buttonDis() 메서드를 실행하는 CLICK IT 버튼을 만들었습니다. <button onclick="buttonDis()">CLICK IT</button> buttonDis() 메서드는 id "button1"로 버튼 요소를 가져오고 비활성화된 속성을 true로 설정합니다. 버튼을 비활성화하면 비활성화된 값(true 또는 false)이 변수 x에 할당되고 id가 "Sample"인 단락에 표시됩니다. function buttonDis() { document.getElementById("Button1").disabled = true; var x=document.getElementById("Button1").disabled; document.getElementById("Sample").innerHTML = "Button disabled is "+x; }