Try

function moveem(){
         Root = document.documentElement;
         G=document.getElementById("yaxisGroup")
         Nodes=G.getElementsByTagName("text")
         for (i=0;i<Nodes.length;i++){
                 currenty=Nodes.item(i).getAttributeNS(null,"y")
                 Nodes.item(i).setAttributeNS(null,"y",eval(currenty)+100)
         }
}
it oughta work in FF, Opera, IE and Batik, though I've heard some 
folks complain that getElementsByTagName is ill-supported in some 
places. If you don't want to use it then you have to open all the 
children of G, examine the nodeName of each, If it is a <text> then 
move it. otherwise don't. That is because some of the children of G 
are #text's consisting of the white space between the tags in the SVG document.

hope this helps
David
At 04:06 AM 1/17/2007, you wrote:

>Hi,
>
>I'm struggling with Javascript and the DOM. Can anyone help me with
>the appropriate script to get the <g> element and loop through the
><text> elements, changing the value of each "y" attribute as I go.
>
>The relevant fragment is shown below.
>
>Thanks, Simon
>
><g id="yaxisGroup" transform="translate(0,0.00) scale(1,1.00)">
><text x="0.00" y="24.00" font-size="18">Dog</text>
><text x="0.00" y="54.00" font-size="18">Cat</text>
><text x="0.00" y="84.00" font-size="18">Horse</text>
><text x="0.00" y="114.00" font-size="18">Bird</text>
></g>
>
>



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to