Reply
IE stylesheet object problem
Old 12-30-2008, 07:50 AM IE stylesheet object problem
KkillgasmM's Avatar
Webmaster Talker

Posts: 519
Name: El Phantasmo
Location: England, north west
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
Quote:
'the object doesn't support this property or method'.
Here is my code, can anybody help?

Code:
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', '');
KkillgasmM is online now
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 12-30-2008, 06:55 PM Re: IE stylesheet object problem
chrishirst's Avatar
Super Moderator

Posts: 19,022
Location: Blackpool. UK
on which line?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-30-2008, 06:58 PM Re: IE stylesheet object problem
KkillgasmM's Avatar
Webmaster Talker

Posts: 519
Name: El Phantasmo
Location: England, north west
lol sorry, the one with

"pAbout2.setProperty ('display', 'none', '');"
KkillgasmM is online now
Reply With Quote
View Public Profile
 
Old 12-30-2008, 07:01 PM Re: IE stylesheet object problem
KkillgasmM's Avatar
Webmaster Talker

Posts: 519
Name: El Phantasmo
Location: England, north west
Hmmm that's wierd, Im testing it now and there's no error message?? Having said that, the css properties still aren't changing the way they should!

One thing I forgot to point out:
If I alert (pAbout3) it says 'Object', and if I alert (styleSheet.rules[23].cssText); it says 'undefined'.

How confusing??

Last edited by KkillgasmM : 12-30-2008 at 07:15 PM.
KkillgasmM is online now
Reply With Quote
View Public Profile
 
Old 12-30-2008, 07:14 PM Re: IE stylesheet object problem
chrishirst's Avatar
Super Moderator

Posts: 19,022
Location: Blackpool. UK
I don't think the style.setProperty method has been implemented in most browsers. Sure it's the W3C approved method but hey

use the standard

objVar.display = "none"; instead
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-30-2008, 07:29 PM Re: IE stylesheet object problem
KkillgasmM's Avatar
Webmaster Talker

Posts: 519
Name: El Phantasmo
Location: England, north west
Ahhhh maaaaaaaaaaaan Bill Gates and his never ending armies of darkness strikes again!

Thanks anway!
KkillgasmM is online now
Reply With Quote
View Public Profile
 
Old 12-30-2008, 07:57 PM Re: IE stylesheet object problem
stevej's Avatar
Keyboard-Mashing Talker

Posts: 881
Location: Outside of yonkers
Technically, it's not Bill Gates' fault. It's the browser's fault.

- Steve
stevej is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to IE stylesheet object problem
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.10188 seconds with 12 queries