Re: gteElementById for animate?
Daniel Holbert <[email protected]> Tue, 02 Feb 2010 18:21:09 -0800
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Message-ID | <[email protected]> |
> Any idea why I can't get the
> animate element?
Probably because you're using Firefox 3.6 (or lower), which lacks SVG
Animation support and hence doesn't recognize the <animate> node.
It treats it the same as it would treat e.g.
<asdfasdf id="migrationAnimateX" ...>
(which it will also refuse to look up by ID)
In mozilla-central nightly builds (which have SMIL support), though, this
works fine. getElementById returns the animate element, and it
successfully updates its 'to' attribute. I've posted an example here,
using the javascript you provided, plus an 'alert' to demonstrate
non-nullness:
http://people.mozilla.org/~dholbert/tests/jjb_animate_issue/x2-example.svg
~Daniel
On 02/02/2010 04:43 PM, John J Barton wrote:
> Hi...
>
> I put this line in my svg doc
> <animate id="migrationAnimateX" attributeName="x2" from="1" to="80"
> dur="2s"/>
> Then I tried Javascript:
>
> doc.getElementById("migrationAnimateX").setAttribute('to', x2);
>
> But I get null from the getElementById? Just before this code I used
> getElementById() to find a line element. Any idea why I can't get the
> animate element?
>
> Thanks,
> jjb
> _______________________________________________
> dev-tech-svg mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-svg