Help accessing elements of elements using the DOM

Hi 

 

I have the following svg fragment contained in a svg document:

 

<g id="level_7">

<path id="Colour1" style="fill:#FFFFFF;"
d="M73.499,107.353c-16.467,0-19.75-3.085-19.75-3.085

 
c0-5.992,0.244-8.813,0.705-14.189c-1.129,2.818-2.533,5.104-2.533,5.104c-
6.533-0.096-10.047-6.465-10.047-6.465

 
c11.824-10.738,23.309-9.486,23.309-9.486s0.635,0.127,0.77,0.152c2.262,0.
422,4.807,0.707,7.547,0.707

 
c2.738,0,5.287-0.285,7.545-0.707c0.139-0.025,0.771-0.152,0.771-0.152s11.
482-1.252,23.309,9.486c0,0-3.516,6.369-10.049,6.465

 
c0,0-1.404-2.285-2.531-5.104c0.461,5.377,0.703,8.197,0.703,14.189C93.247
,104.268,89.964,107.353,73.499,107.353z"/>

            <path id="Shirt_Outline_2_"
style="fill:none;stroke:#000000;stroke-width:2.856;" d="M73.499,107.353

 
c-16.467,0-19.75-3.085-19.75-3.085c0-5.992,0.244-8.813,0.705-14.189c-1.1
29,2.818-2.533,5.104-2.533,5.104

 
c-6.533-0.096-10.047-6.465-10.047-6.465c11.824-10.738,23.309-9.486,23.30
9-9.486s0.635,0.127,0.77,0.152

 
c2.262,0.422,4.807,0.707,7.547,0.707c2.738,0,5.287-0.285,7.545-0.707c0.1
39-0.025,0.771-0.152,0.771-0.152

 
s11.482-1.252,23.309,9.486c0,0-3.516,6.369-10.049,6.465c0,0-1.404-2.285-
2.531-5.104c0.461,5.377,0.703,8.197,0.703,14.189

 
C93.247,104.268,89.964,107.353,73.499,107.353z"/>

            <path id="Shirt_Shadow_2_" style="opacity:0.25;"
d="M78.345,79.615c0,0,6.412,14.311,2.953,27.727c0,0,9.793-1.031,11.949-3
.074

 
L92.79,91.502l2.285,3.68c0,0,5.586-0.012,9.873-6.789c0,0-6.514-5.547-15.
357-8.182C89.591,80.211,84.345,78.566,78.345,79.615z

                        "/>

</g>

 

I am able to use the getElementById function to return the element with
an id of 'level_7'. 

level  = document.getElementById('level_7');

 

I now need to get the element with an id of 'Colou1_1' and change some
of its attributes.

color = level.getElementById('Colour1');

 

Yet this causes errors saying the object does not support this function?

 

How else can I a) Get a element b) Get elements of the element?

 

Hope this is clear.

 

Thanks,

 

Sam

Received on Tuesday, 3 February 2004 23:05:04 UTC