JavaScript Reference/Javascript Properties/owningElement

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

"owningElement" Example

   <source lang="javascript">
   

<html> <body> <style id="myS">

  1. myP1 {
   color:red; 

}

  1. myP2 {
   color:green; 

} </style>

text.

text.

<input type="button" value="owningElement" onclick="function1();"> <script language="JavaScript">

   function function1() {
       var m = document.styleSheets[0].owningElement.id;
       alert(m); 
   } 

</script>


     </source>
   
  


"owningElement" is applied to

   <source lang="javascript">

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

     </source>
   
  


"owningElement" Syntax and Note

   <source lang="javascript">

Note: Read-only property. Returns a reference the styleSheet.

Syntax:

document.styleSheets[index].owningElement


     </source>