Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mozilla doesn't like this IE compatible: createStyleSheet

Status
Not open for further replies.

Sniipe

Programmer
Oct 9, 2006
115
IE
document.createStyleSheet is not a function

Is there a substitute method I can use for this line:

Code:
var oSS = document.createStyleSheet();
	with(oSS)
	{
         ...
         }
 
thanks for the post cLFlaVA,

Looks like I've hit a brick wall from that post. I don't know how to convert the rest of the code after that.

Code:
function writeStyle()
{
   var oSS = document.createStyleSheet();
   with(oSS)
   {
      addRule(".Calendar", "FONT-FAMILY:Tahoma; POSITION:absolute; DISPLAY:none; Z-INDEX:-1");
      addRule(...
           ...
   }
}

Unfortunately, I'm not overly familiar with CSS so I'm just gonna opt out of this code. I was hoping for an easy option out by changing a few lines of code.
 
ok, I've gotten a tiny bit further
I have an if statement to check if the browser is IE or other.

This is the IE code that works well:
addRule(".Calendar", "FONT-FAMILY:Tahoma; POSITION:absolute; DISPLAY:none; Z-INDEX:-1");

and I tried this line as I thought it might be the same:
myStyleSheet.insertRule(".Calendar", "FONT-FAMILY:Tahoma; POSITION:absolute; DISPLAY:none; Z-INDEX:-1");

But no joy, I really am hacking as this is really not my field at all. I'd really appreciate some help with this if at all possible.
 
why are you testing for IE / Non-IE browsers? Why not develop a method that works for all browsers? Ditch the createStyleSheet functionality altogether, and go with the one mentioned in the article.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
I'm sorry cLFlaVA, I'm a new graduate .net programmer and this vbscript with javascript in it is wrecking my head. Whats there is currently working, so I don't want to wreck it. Its a large amount of code for a date picker program. I'll have another look at the page u gave me, but it is a bit daunting.
 
I know what ur saying, why am I trying to re-invent the wheel. I had a look a few of the current free date pickers and none of them really suited my needs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top