Thanks, Martin. It worked fine in FF2 and IE7/ASV3.
I also tried the following that was provided to me in another forum
but it only worked in FF2 and not IE7/ASV3. Any idea why this is?
var myEl=document.getElementById('yaxisGroup').getElementsByTagName
('text');
var newVal=['15.00','12.00','43.00','62.00'];// the new values for
the x attribute
var i=0, e; while(e=myEl[i++]){ e.setAttribute('x',newVal[i-1]); }
--- In [email protected], "Martin Honnen"
<[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "simonshutter" <simon@>
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/