[thelist] Dynamic StyleSheets?

Eric Costello eric at schwa.com
Sun Jul 23 21:37:25 CDT 2000


>Is there a way to dynamically assign a style sheet according to the browser
>and client type? I seem to remember seeing some js snippets somewhere that
>could do this. I just don't remember where.

Not sure if this is exactly what you are looking for, but here is a solution
I have used to feed one style sheet to both NS and IE, one with NS specific
styles to NS and another with IE styles to IE. Just include it all in the
head of your document. The "disabled" attribute is only understood by IE, so
NS ignores the attribute while IE ignores the style sheet. "document.all"
evaluates to false in NS, true in IE.


<link rel="stylesheet" type="text/css" href="both.css">
<link rel="stylesheet" type="text/css" href="ns.css" disabled>
<script language=javascript>
	<!--
	if (document.all) {
	document.write('<link rel="stylesheet" type="text/css" href="ie.css">');
	//-->
</script>


Eric

Eric Costello
eric at schwa.com
http://glish.com





More information about the thelist mailing list