This method is used to instantiate a new style object for when tags occur within the tags or classes of other types. For example, you can build a contextual style object that combines two tag types and specifies that when, and only when, they are used in that context, a certain style appearance is defined.
This fragment of JavaScript will yield a style object that is relevant to the contents of an <H1> tag:
myStyle1 = document.tags.H1;
This fragment will yield a style object relevant to text inside a <B> tag (bold text):
myStyle2 = document.tags.B;
Now we can combine the two to yield a style object that applies only to content between the <B> tags when they are inside <H1> tags:
myStyle3 = document.contextual(myStyle1, myStyle2);
Finally, we can set some attribute of that style:
myStyle3.color = "Blue";
So, any text inside <B> tags inside <H1> tags will be blue.
This needs to be executed in a <SCRIPT> block in the <HEAD> portion of the document and cannot be executed after the body has commenced loading.
The result of this method call is a style object that operates within a particular context.
Because this is part of the JSS support, its use is deprecated and likely to become redundant now that Netscape is orienting its style sheet capabilities towards the open standards from W3C.
Prev | Home | Next |
Document.close() | Up | Document.cookie |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |