Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
I don't think IE allows you to append style elements to the head. They want you to use their StyleSheet object. Or it could be possible that IE just doesn't allow you to create text nodes to dictate style rules.
Just take the approach of using inline styles instead. Inline styles are universally compatible. The slightly older Opera and Safari don't even allow stylesheet changes.
If you need something to be hidden only if JavaScript is enabled, do something like this:
HTML Code:
<body><!--opening body tag-->
<script type="text/javascript">
document.body.className = (document.body.className)
? document.body.className + " enabled"
: "enabled";
</script>
This adds a class of enabled to the BODY element, but won't remove any class that already is on the body. Then, in your regular stylesheet, you could specify a rule like this:
CSS
Code:
.enabled #coolText {display: none;}
Since the class is added before the rest of the HTML is parsed (the script is right after the opening BODY tag), the special text will be hidden automatically and will never "flicker".
Last edited by wayfarer07; 06-01-2009 at 09:10 AM..
|