473,769 Members | 5,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to Find the ParentNode

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.get ElementsByTagNa me("polyline") ;
for ( var i=0; i < poly.length; i++ )
{
myobj=poly.pare ntNode(i);
alert(i + myobj);
}

This is not working. Any help is appreciated.

Mike

Jul 20 '05 #1
3 1933
"Michael Hill" <hi****@ram.lmt as.lmco.com> wrote in message
news:40******** *******@ram.lmt as.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.get ElementsByTagNa me("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.pare ntNode(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.
Jul 20 '05 #2
On Thu, 15 Jan 2004 04:47:12 -0000, "Richard Cornford"
<Ri*****@litote s.demon.co.uk> wrote:
"Michael Hill" <hi****@ram.lmt as.lmco.com> wrote in message
news:40******* ********@ram.lm tas.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.get ElementsByTagNa me("polyline") ;
I haven't had much to do with scripting the SVG DOM yet, but:-


It's nice! You've got DOM 2,
JScript, JavaScript (both rhino and spidermonkey) and KJS are all
used by good SVG user agents, although it's a time when using the
Compact Profile (ECMA 327 is it? - this could be FAQ'd actually?) as
there are a lot of scriptable mobile user agents.

There is an old SVG browser (ASV 2 in NN4) that doesn't have try/catch
but all others do and you're probably safe to use it.
myobj = poly[i].parentNode;


Yep!

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #3
"Jim Ley" <ji*@jibbering. com> wrote in message
news:40******** *******@news.ci s.dfn.de...
<snip>
I haven't had much to do with scripting the SVG DOM yet, but:-


It's nice! You've got DOM 2, JScript, JavaScript
(both rhino and spidermonkey) and KJS are all used
by good SVG user agents, although it's a time when
using the Compact Profile (ECMA 327 is it? - this
could be FAQ'd actually?) as there are a lot of
scriptable mobile user agents.

<snip>

Yes, ECMA 327 is the Compact Profile and it probably does deserve a
mention in the FAQ. Especially as it is only two pages on the features
from ECMA 262 that do not need to be implemented in the Compact Profile.

Richard.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
20220
by: jklimek | last post by:
I have something like this: <table name="test" id="test"> <tr> <td><input type="button" onClick="showMeParentTableName();"></td> </tr> </table> How can I have my input button show me the table of it's parent table?
3
11631
by: ningjun.wang | last post by:
Hello: My html file contains the following image link: <a href="some_url"><img src="MyImage.gif"></a> How can I use Javascript to find out the value of some_url for the given image name "MyImage.gif"? I know how to get the image object with a given name (e.g.
2
22049
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. Thanks in advance for any help, Jack
2
15822
by: amattie | last post by:
Anyone know what the specific difference is between the offsetParent and parentNode properties of a DOM element are? Mozilla's docs on the DOM element (http://developer.mozilla.org/en/docs/DOM:element) don't really indicate much of a difference, but whatever the difference is is really screwing me up in one of my projects. On a specific div node nested within a whole bunch of other div nodes in the DOM, the parentNode property evaluates...
7
37903
by: webdeveloper | last post by:
Without showing any code, I thought maybe somebody already knows what the error message in the title generally means? But in short, a menu is supposed to display by setting its inline style attribute to: display="none" vs 'display="block" upon an onclick of an "<a>" element. That link ("<a>") element is accessed via DOM by using something like "this.parentNode.childNodes.style.display="none", or "block" to display a menu below it. The...
0
12791
by: jiing | last post by:
Hi all, I want to use sting(the same as Node.Text) to judge if a node exists in TreeView. I've tried several ways, but seems all failed. could anybody help me? Thanks in advance. //My TreeView is defined to has depth =3 only.
3
4641
by: gouthami | last post by:
I have a tree Node in my application and i have set the following code in the NavigateUrl property of the tree node. Please see my code below (which is present in my 'code behind' c# file). My requirement is to open a new window (.aspx page) on clicking a tree node (Menu) with out status bar, address bar etc. TreeNode parentNode = new TreeNode(); tnc.Add(parentNode); parentNode.Target = "none";...
2
8117
by: bent27 | last post by:
I'm new to javascript...I'm getting 'parentNode' is null or not an object error in the following code for (var ci=0;ci<headerLink.parentNode.childNodes.length;ci++) { if (headerLink.parentNode.childNodes.tagName && headerLink.parentNode.childNodes.tagName.toLowerCase() == 'span') span = headerLink.parentNode.childNodes; } can anybody tell me what is the error ?
3
3663
XtinaS
by: XtinaS | last post by:
I'm trying to write a script for Greasemonkey that will, in LiveJournal, replace a placeholdered embedded YouTube thing with a link to the video. In LiveJournal, you can set an option to have a placeholder instead of the actual embedded YouTube video. This is what that code looks like: <div class="LJ_Placeholder_Container" style="width: 475px; height: 405px;"> <div class="LJ_Placeholder_HTML" style="display:...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.