« HelpProvider & HTML Help Workshop Use Guide | Main | PictureBox Image Display »

Client script tricks for generating dynamic CSS styles

An easy way to define css styles that are functions of client script, note that the document.write inserts a string after the block of script in which it is embedded:

var CSSInsertion =

      '<STYLE><!--\r\n'

      +'@FONT-FACE {FONT-FAMILY:MYFONTONE; FONT-STYLE:NORMAL; FONT-WEIGHT:NORMAL; SRC:URL(../fonts/font.eot);}'

      +'.BOOKTITLE {BACKGROUND-IMAGE:URL('+BeforeReference+'Basics/banner.gif);}'

      +'\r\n// --></STYLE>';

 

document.write(CSSInsertion);

 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)