|
|
 |
FN-FORUM: JavaScript problem - accessing CSS rules via DOM
date posted 25th January 2008 12:48
Hi,
Im trying to access a CSS rule after I've dynamically replaced a CSS
file with another one using DOM. Firefox throws an error:
A parameter or an operation is not supported by the underlying object"
code: "15
When I alert() .href values of each CSS loaded into DOM, the above
error doesn't show and it works OK.
Code:
replacejscssfile("old.css","new.css","css"); // this function replaces
CSS file with a new one
for (var t=0; t< document.styleSheets.length; t++)
{
alert(document.styleSheets[t].href); // if I comment out this line,
FF will show an error
}
var styleSheet = document.styleSheets[1];
if (styleSheet.rules) styleSheet.cssRules = styleSheet.rules;
map_resized_width = styleSheet.cssRules[0].style.width;
document.getElementById("map").style.width = map_resized_width;
Any thoughts?
I would like to access that CSS rule from newly inserted CSS in order
to resize google map properly. It wont resize properly by only
changing CSS file which defines its look.
Thanks
Jay
--
Web Developer
Cathill Design
Web Development | Graphic Design | Multimedia
www.cathill.com/portfolio
|
 |
|