styleSheet개체들로 문서에 도입된 모든 스타일쉬트들의 배열변수 컬렉션을 참조한다.


Script
[cVal]=styleSheet.imports
[oVal]=styleSheet.imports(index)
인수
styleSheet : (개체)
필수적인 요소이고 imports 컬렉션을 포함하는 모체 개체이다.

cVal : (컬렉션)
선택적인 요소이고 값은 imports 컬렉션을 나타내는 개체이다.

oVal : (개체)
선택적인 요소이고 값은 imports 컬렉션의 한개의 엘레멘트 개체이다.

index : (정수)
필수적인 요소이고 값은 imports 컬렉션의 인수나 문자열로 한개의 엘레멘트 개체를 참조할수 있고 배열변수의 규칙에따라 0부터 시작하고 제일 마지막 인수는 길이보다 1 작다.

특기

도입된 스타일쉬트는 <STYLE>@import</STYLE> 태그에 의하여 문서에 가져온 스타일쉬트를 말한다.

적용
개체scriptHTML규격IE
styleSheet[cVal]=styleSheet.imports없음없음IE4.0(win16,win32,ce,mac,unix)

collection
imports
imports
속성메서드예제
이전페이지로페이지 맨위로페이지 맨아래로

imports 설명을 위한 예제

도입 스타일 적용
<style id="cssObj">@import 'exp/samp.css';@import 'exp/sample.css';</style> <script>oObj=document.styleSheets(1).imports;</script><u class="samp">도입 스타일 적용</u>

collection
imports
imports
메서드견본예제
이전페이지로페이지 맨위로페이지 맨아래로
length 속성 IE
⇒ 컬렉션의 길이를 반환하거나 지정한다.
문법: [iVal=]styleSheet.imports.length
코드: document.write(oObj.length); 결과:
코드: document.write(oObj[0].cssText); 결과:

collection
imports
imports
속성견본예제
이전페이지로페이지 맨위로페이지 맨아래로
item 메서드 IE
⇒ 인덱스로 filters 등 컬렉션의 한개의 개체를 반환한다.
문법: [cVal=]styleSheet.imports.item(iVal)
코드: document.write(oObj[0]) 결과:
코드: document.write(oObj[0].rules[0].selectorText) 결과:
namedItem 메서드 IE6
⇒ 이름(name)이나 인식자(id) 문자열에 해당하는 imports 컬렉션에서 한개의 개체나 하부 컬렉션을 반환한다.
문법: [cVal=]styleSheet.imports.namedItem(sVal)

collection
imports
imports
속성메서드견본
이전페이지로페이지 맨위로페이지 맨아래로

imports 컬렉션 예제

<SCRIPT>
str='document.styleSheets.length='+document.styleSheets.length+'<BR>'
for (i=0;i< document.styleSheets.length;i++){
    str+='document.styleSheets[i].owningElement.tagName='+document.styleSheets[i].owningElement.tagName+'<BR>';
    for (j=0;j< document.styleSheets(i).imports.length;j++){
     str+='도입된 스타일쉬트(document.styleSheets('+i+').imports('+j+').href)는 ';
     str+='<FONT color=blue>'+document.styleSheets(i).imports(j).href+'</FONT>에 있다.<BR>';
    }
}
document.write(str);
</SCRIPT>
collection
imports
속성메서드견본예제
이전페이지로페이지 맨위로
최종 수정:
06/20/2025 20:50:43
KoXo Homepage
All right reserved
비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다.
오류가 나면 정상적 접속으로 시도해 보세요.
http://koxo.com/lang/js/object/imports.html