'defaults' Example : defaults « Javascript Objects « JavaScript Reference

'defaults' Example

    
<html xmlns:yourNs>
<head>
<?import namespace="yourNs" implementation="yourHTC.htc"></head>
<body><div style= "color:red; 
                   font-size:20pt; 
                   font-Style:italic; 
                   border:2px solid blue">
<br>Sample text in the main document<br>
<yourNs:yourTagName></yourNs:yourTagName>
</div>
</body>
</html>

<!--
Contents of yourHTC.htc:
-->
<public:component tagName="yourTagName">
<attach event="oncontentready" onevent=contentReady() />
</public:component>
<script language="JavaScript"> 
function contentReady(){
    defaults.viewLink = document;
    defaults.viewInheritStyle = false;
    defaults.viewMasterTab = false; 
}
function inheritStyle() {
    boolInherit = defaults.viewInheritStyle;
    defaults.viewInheritStyle = true; 
}
</script>
<body>
<div id="extDiv" 
     style="font-size:20pt; font-weight:bold; border:3px solid green">
     Imported Document Text
</div>
<br>
<button onclick="inheritStyle();">Set Inheritance to True</button>
</body>

    
      
      








Related examples in the same category

1.'defaults' Syntax and Note
2.'defaults' Event Handlers
3.'defaults' CSS Attributes and JavaScript Style Properties
4.'defaults' JavaScript Properties