Question about some basic functions in SVG ECMAScript
Sorry I couldn't find appropriate group for
SVG and ECMAScript. Since SVG is in XML format
What's why I post in these two groups.
In the O'Reilly SVG book, in chapter 11
Animating and Scripting SVG. It mentions
some very basic functions like
var circle = event.getTarget();
var obj = svgDocument.getElementById("idName");
I got error message said these are no a function
in Firefox and batik-squiggle.jar
When I used SVGView plug-in (made by Adobe) for IE .
var svgObject = evt.target;
var svgDoc = svgObject.getOwnerDocument();
var svgElement = svgDoc.getElementById(idName);
var svgStyle = svgElement.getStyle();
These lines are working fine for SVGViwe Plug-in by
not work for Firefox and batik.
They complained that getOwnerDocument is not a function.
I tried to change getSVGDocument but no luck.
Is that O'Reilly book too old? Its first editoin is 2002.
How can I make getElementById() working in Firefox and Batik?
Is there some examles or some documents?
Thank Q very much in advance!
Re: Question about some basic functions in SVG ECMAScript
> var circle = event.getTarget();
> var obj = svgDocument.getElementById("idName");
> var svgObject = evt.target;
> var svgDoc = svgObject.getOwnerDocument();
> var svgElement = svgDoc.getElementById(idName);
> var svgStyle = svgElement.getStyle();
> svgStyle.setProperty('stroke-width', 3);
The ECMAScript binding for the DOM want you to use e.g.
and not those getXXX variants you are using.
With the Adobe SVG viewer you can use both variants but for newer SVG
implementations you need the variants I have outlined above.
|All times are GMT. The time now is 12:43 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.