W3C home > Mailing lists > Public > www-svg@w3.org > July 2001

dynamic change of internal stylesheet

From: marcel salathe <marcel@salathe.com>
Date: Tue, 17 Jul 2001 10:39:10 +0200
Message-ID: <3B53F9AE.3385430@salathe.com>
To: www-svg@w3.org
How can I dynamically change an internal stylesheet?

I know that changing properties with javascript is straighforward

var SVGDoc = document['whatever'].getSVGDocument();
var myObj = SVGDoc.getElementById('anyElement');
var myObjStyle = myObj.getStyle();
myObjStyle.setProperty ('fill', 'green');

if the attribute style is defined in an element:

<rect id="anyElement" x="0" y="0" width="100" height="100"

But what if styles are defined like this:

<style id="myStyle1" type="text/css"><![CDATA[
rect {
<rect x="0" y="0" width="100" height="100"/>

I can read the information:

var SVGDoc = document['whatever'].getSVGDocument();
var myObj2 = SVGDoc.getElementById('myStyle1');
var myTextNode = myObj2.getFirstChild();
var myValue = myTextNode.getData();



does not have any effect.

any ideas?

Received on Tuesday, 17 July 2001 04:40:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:51 UTC