Again, some old code I'm not using anymore since I switched to jQuery but that might be useful for someone:
/* * Public Domain * Created by Toni Corvera <outlyer@outlyer.net> in September, 2006 * * Creates a new CSS ruleset, should work with multiple rules correctly * e.g.: * loadCssRules('body{font-family:sans-serif;}a:link{color:red;}'); */ // void function loadCssRules(String rules) function loadCssRules(r) { if (!document.createElement) return; var newStyle=document.createElement('STYLE'); newStyle.setAttribute('type', 'text/css'); newStyle.appendChild(document.createTextNode(r)); document.getElementsByTagName('HEAD')[0].appendChild(newStyle); }
Downloadable file: http://p.outlyer.net/graveyard/net_outlyer_dyn_css.js
Discover more from OutlyerNet
Subscribe to get the latest posts to your email.