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
https://forums.phpfreaks.com/topic/138795-ie-stylesheet-object-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.