"Michael Hill" <hi****@ram.lmtas.lmco.com> wrote in message
news:40***************@ram.lmtas.lmco.com...
I am trying to get all the "polyline" tags and then find the
parent node above it so I can transform it.
var poly = svgDocument.getElementsByTagName("polyline");
I haven't had much to do with scripting the SVG DOM yet, but:-
for ( var i=0; i < poly.length; i++ )
{
myobj=poly.parentNode(i);
In principal - poly - is a nodeList interface implementing object. In
JavaScript/ECMA Script it should be posible to access numerically
indexed members of a nodeList in the same way as an Array is accessed;-
poly[i] - or using the nodeList's - item - method - poly.item(i) - .
That should return a reference to one of the "polyline" elements. It is
those elements that may/should have a parentNode property, not the
nodeList object.
The object that represents the parentNode (if any) would be another
element and almost certainly implemented as an object, not a function.
So calling that property and passing - i - as a parameter to that
function call doesn't make much sense. Probably you want something
like:-
myobj = poly[i].parentNode;
alert(i + myobj);
If - i - is an integer and - myobj - refers to an object what do you
expect to be the result of adding them together? You can type-convert
them to strings and get the - + - operator to do concatenation by adding
a string to that expression:-
alert( i + " " + myobj);
The result should also be clearer to read, as it will introduce a space
between them.
}
This is not working. Any help is appreciated.
"This is not working" is rarely sufficient information to allow anyone
to usefully comment on why something isn't working. You need, at the
very least, to provide a context (testing/execution environment(s)) for
it and some criteria for "working" and details of how failure to achieve
that is manifesting itself. Particularly important are any error
messages generated.
Richard.