473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

getElementById not implemented?

Hi all,

I'm having some problems understanding why I'm getting an error with
the following SVG document:
http://www.danrumney.co.uk/test.svg

The javascript is pretty basic, call "getElementById" method of an
SVGSVGElement object in order to get a child element of it with a
specified ID... instead I see

Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
[nsIDOMSVGSVGElement.getElementById]" nsresult: "0x80004001
(NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
http://www.danrumney.co.uk/demo.js :: <TOP_LEVEL:: line 4" data: no]

In the Javascript console.

I'm using Firefox 1.5.0.8. The SVG *is* rendering, so I know that the
SVG is fine. Also, the javascript is simple enough that, by inspection,
it all looks fine.

What I'm thinking is that, perhaps a different Javascript interpreter
is used for SVG as compared to the one for HTML. Not sure *why* this
would be the case, but I can't think of an alternative reason.

Any suggestions/guidance would be appreciated.

Dan

Dec 5 '06 #1
3 4296
da*******@warpmail.net wrote:
I'm having some problems understanding why I'm getting an error with
the following SVG document:
http://www.danrumney.co.uk/test.svg

The javascript is pretty basic, call "getElementById" method of an
SVGSVGElement object in order to get a child element of it with a
specified ID... instead I see

Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
[nsIDOMSVGSVGElement.getElementById]" nsresult: "0x80004001
(NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
http://www.danrumney.co.uk/demo.js :: <TOP_LEVEL:: line 4" data: no]
You need to call getElementById on the document object, not on an element.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 5 '06 #2
You need to call getElementById on the document object, not on an element.
While it may not be *the* reference,
http://www.xulplanet.com/references/...VGElement.html,
indicates that getElementById is a method of the SVGSVGElement.

However, the change you recommended did work.

However, does that mean, then, that you cannot call "getElementById" on
arbitrary SVGElements?

Thank you.

Dec 5 '06 #3
da*******@warpmail.net wrote:
>You need to call getElementById on the document object, not on an element.

While it may not be *the* reference,
http://www.xulplanet.com/references/...VGElement.html,
indicates that getElementById is a method of the SVGSVGElement.

However, the change you recommended did work.

However, does that mean, then, that you cannot call "getElementById" on
arbitrary SVGElements?
The Core DOM W3C specification defines a method getElementById on the
document object. As ids have to be unique inside the document that
method suffices.
SVG seems to additionally define a method getElementById on
SVGSVGElement (<http://www.w3.org/TR/SVG11/ecmascript-binding.html>) but
it does not look as if that method is implemented in Mozilla so far
<https://bugzilla.mozilla.org/show_bug.cgi?id=280391>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 5 '06 #4

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

Similar topics

6
by: John Ramsden | last post by:
.... when the id 'junk' doesn't exist anywhere in the document, instead of returning 'object'?! I am using Javascript for a drop-down menu, slightly adapted from one by Angus Turnbull (see...
4
by: TR | last post by:
My document had the following nested DIV structure, with a possible <SPAN> between the DIV and the <A> elements: <div id="container"> <div id="D1"> <span>blah blah</span><br> <A...
15
by: lawrence | last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this script hoping to animate some div blocks on a page. You can see the page here: http://www.keymedia.biz/demo.htm Can anyone...
4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
3
by: soup_or_power | last post by:
Hi Sorry about the heading. I have a table with td consisting of lists with <select></select>. When I do a document.getElementById("element").innerHTML I don't see the selected item. IOW, the...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
29
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
8
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.