HTML DOM 스크립트 객체
스크립트 개체
Script 개체는 HTML <script> 요소를 나타냅니다.
스크립트 개체에 액세스
getElementById()를 사용하여 <script> 요소에 액세스할 수 있습니다.
예시
var x = document.getElementById("myScript");
팁: 스크립트 컬렉션 을 사용하여 <script> 요소에 액세스할 수도 있습니다 .
스크립트 개체 만들기
document.createElement() 메서드를 사용하여 <script> 요소를 만들 수 있습니다.
예시
var x = document.createElement("SCRIPT");
스크립트 개체 속성
Property | Description |
---|---|
async | Sets or returns whether a script should be executed asynchronously as soon as it is available |
charset | Sets or returns the value of the charset attribute of a script |
crossOrigin | Sets or returns the the CORS settings of a script |
defer | Sets or returns whether a script should be executed when the page has finished parsing |
src | Sets or returns the value of the src attribute of a script |
text | Sets or returns the contents of all the text nodes that are children of a script |
type | Sets or returns the value of the type attribute of a script |
표준 속성 및 이벤트
Script 개체는 표준 속성 과 이벤트 도 지원합니다 .
관련 페이지
HTML 참조: HTML <script> 태그