--- In [email protected], "simonshutter" <[EMAIL PROTECTED]> wrote:
> 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.
> <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>
var g = document.getElementById('yaxisGroup');
var textElements =
g.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'text');
for (var i = 0, l = textElements.length; i < l; i++) {
var textElement = textElements.item(i);
var attributeValue = textElement.getAttributeNS(null, 'y');
// example on setting the attribute value
textElement.setAttributeNS(null, 'y', Number(attributeValue) * 2);
}
-----
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/