treevis

November 2006 Archive

JS-only CSS

Do you have CSS that is only used when you have JS enabled? Are you trying to avoid some flickering of pre-JS-ified content? Then put that CSS in its own JavaScript-specific CSS file and write it to your HTML via one of two options.

Good ol’ document.write()

<script type="text/javascript">
//<![CDATA[
document.write(’<link rel="stylesheet" href="js.css" type="text/css" />’);
//]]>
</script>

Slick new DOM:

<script type="text/javascript">
//<![CDATA[
var lnk […]