JavaScript Reference/Javascript Properties/parentStyleSheet

Материал из Web эксперт
Перейти к: навигация, поиск

"parentStyleSheet" Example

   <source lang="javascript">
   

<html> <body> <style id="myStyle" type="text/css">@import url("external.css");</style>

sample text.

sample text.

<input type="button" value="The parent style sheet" onclick="function1();"> <script language="JavaScript">

   function function1() {
       alert(document.styleSheets[0].imports[0].href);
   }

</script> </body> </html>


     </source>
   
  


"parentStyleSheet" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |styleSheet | +----------------+--------------------------------------------------------------+

     </source>
   
  


"parentStyleSheet" Syntax and Note

   <source lang="javascript">

Note: Read-only property. Returns a reference to the styleSheet. Returned value is null, if not imported via @import.

Syntax:

document.styleSheets[index].parentStyleSheet document.all.styleID.parentStyleSheet


     </source>