In IE with document.getElementById("css_id").styleSheet
or in Firefox document.getElementById("css_id").sheet
I've a style sheet object to manipulate but in Chrome and Safari browser that property there is not.
How can I get that object?
Thanks
In IE with document.getElementById("css_id").styleSheet
or in Firefox document.getElementById("css_id").sheet
I've a style sheet object to manipulate but in Chrome and Safari browser that property there is not.
How can I get that object?
Thanks
Errr, in my tests .sheet works fine -- my testcase was
<html>
<head>
<style id="styleElement"></style>
<link id="linkElement" data="data:text/css," rel="stylesheet"></link>
<script>
window.onload=function() {
alert(["<style element>.style: " + document.getElementById('styleElement').sheet,
"<link element>.style: " + document.getElementById('linkElement').sheet])
}
</script>
</head>
</html>
I only tested in Safari 3.2 and the WebKit nightlies, Chrome just uses the WebKit from Safari 3.1 but i don't believe there's any engine changes between 3.1 and 3.2.