Create CSS Class (JavaScript)
This function ( createCSSClass ) creates a new class with the given style. However, it does not work in version of Opera prior to 9, due to lack of support for document.styleSheets . For example, if you want all text in a pre element bold, you would do createCSSClass("pre", "font-weight: bold") . Note, that if you already have the rule defined, it will replace it, unless it is not a stylesheet with media type 'screen' (or media not set) or it is not the first linked/embedded screen stylesheet. So for example, if you had the following: <link rel="stylesheet" href="print.css" media="print" /> <link rel="stylesheet" href="screen.css" /> <style type="text/css">pre { border: 1px solid #000}</style> When you do createCSSClass("pre", "font-weight: bold") , it will replace the rule in screen.css (or add it if it does not exist). Any styles defined in print.css...