이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 참여해서 번역을 마치도록 도와 주세요!
English (US)의 문서도 읽어보세요.

id
Type: unique id
A unique identifier so that you can identify the element with. You can use this as a parameter to getElementById() and other DOM functions and to reference the element in style sheets.

Example

<button id="foo" label="Click Me" oncommand="doSomething()"/>

<script>
function doSomething(){
    var myButton = document.getElementById('foo');
    myButton.setAttribute('label','The button was pressed');
}
</script>

A more abstract version of the above would be a

<button id="foo" label="Click Me" oncommand="setWidgetLabel(this, 'I was pressed')"/>
<script>
function setWidgetLabel(idName, newCaption){
   document.getElementById( idName.id ).setAttribute('label',newCaption)
}

</script>
Not specifying the id attribute for a window or a prefwindow fills the console with the following warning message: Warning: Empty string passed to getElementById()

See also

문서 태그 및 공헌자

이 페이지의 공헌자: SphinxKnight, Sheppy, trevorh, pippijn, Mossop, madarche, Marsf, Mgjbot, Ptak82, Okome, Pmash, Enn, Dria
최종 변경자: SphinxKnight,