Jump to content

IE stylesheet object problem


rollOrDie

Recommended Posts

Im trying to create a script that will edit css rules in both FF and IE, but IE just isn't having any of it! I get an error message saying that 'the object doesn't support this property or method'.

 

Here is my code, can anybody help?

 

var styleSheet = document.styleSheets[1];

if (styleSheet.rules)
{
	var pAbout1 = styleSheet.rules[20].style;
	var pAbout2 = styleSheet.rules[22].style;
	var pAbout3 = styleSheet.rules[23].style;
}

else
{
	var pAbout1 = styleSheet.cssRules[20].style;
	var pAbout2 = styleSheet.cssRules[22].style;
	var pAbout3 = styleSheet.cssRules[23].style;
}

pAbout2.setProperty ('display', 'none', '');
pAbout3.setProperty ('display', 'none', '');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.