contextual() (Method)

A JSS style control method.


JavaScript - 3.0
Netscape - 4.0
JavaScript syntax:Ncontextual(tags.anItem, ...).aProperty = aValue
Argument list:anItemA tag name such as P or B or H1
aPropertyA style property of the returned tags object
aValueA value to be stored in the property of the nominated tags.

This function can take a variable number of arguments, each one indicating a tag property within the tag's object. It is followed by a dot-delimited property value and basically provides a way to modify the same property across a large number of objects in a single call.

This could be a quite useful function for a variety of other non-style-related cases. You may want to experiment and see whether, in your browser, the contextual() method is useful. However, it may only be present in Netscape browsers, thus limiting its usefulness for deployment.

When used in a JSS context, this is more or less equivalent to H1 P { color: red }.


Example code:

   // Set the color property for several objects at once.
   contextual(tags.P, tags.H1).color = "red";

See also:JavaScript Style Sheets


Wrox Instant JavaScript - page - 50