Path: csiph.com!aioe.org!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Using getElementsByName on a DIV ? Supersedes: <1945521.Ox6yzQtThg@PointedEars.de> Date: Thu, 05 May 2016 00:46:21 +0200 Organization: PointedEars Software (PES) Lines: 69 Message-ID: <5472957.EtlMkCADSI@PointedEars.de> References: <571e5590$0$5835$e4fe514c@news.xs4all.nl> <571e6847$0$5912$e4fe514c@news.xs4all.nl> <8760v5a4ic.fsf@bsb.me.uk> <571e72f0$0$5941$e4fe514c@news.xs4all.nl> <87zish8hqk.fsf@bsb.me.uk> <571f1936$1$5824$e4fe514c@news.xs4all.nl> <87d1pc8xzs.fsf@bsb.me.uk> <571f6433$0$5816$e4fe514c@news.xs4all.nl> <877ffk8p59.fsf@bsb.me.uk> <571f9907$0$5862$e4fe514c@news.xs4all.nl> <87shy86wo0.fsf@bsb.me.uk> <571fc489$1$5825$e4fe514c@news.xs4all.nl> <87a8kg6jz8.fsf@bsb.me.uk> <572080a7$0$5941$e4fe514c@news.xs4all.nl> <877ffi619z.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn NNTP-Posting-Host: 90.228.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: gwaiyur.mb-net.net 1462401982 14682 178.197.228.90 (4 May 2016 22:46:22 GMT) X-Complaints-To: abuse@open-news-network.org NNTP-Posting-Date: Wed, 4 May 2016 22:46:22 +0000 (UTC) User-Agent: KNode/4.14.2 Xref: csiph.com comp.lang.javascript:30393 Ben Bacarisse wrote: > "R.Wieser" writes: ^^ ^^^^^^^^^^^^^^^^^^^^^ WTF is this? YTF are you people even talking to this guy? > >> Do I *really* need to spoon-feed the/a problem like in the below ? > > No, you really have to provide an example document along with the code > that doesn't work. > >> [javascript] >> Ancestor = this.parentNode; >> aDescendants = Ancestor.getElementsByTagName("IMG"); >> // aDescendants = Ancestor.getElementsByName("foobar"); >> // aDescendants = Ancestor.getElementsByClassName("foobar"); >> // oDescendant = Ancestor.getElementByID("foobar"); ^^^^^^^^^^^^^^ >> [/javascript] >> >> I thought that should have been clear from my problem description. But >> I guess I expected too much ... Enough niceties extended to the OP. It takes a sharp axe to split a tough log¹: This is not a free customer support forum; you are not a customer, and we are not the customer support team that needs to cater to your every whim in order to avoid losing you. This is a technical newsgroup on software development for (aspiring) software developers. Do your own homework and RTFFAQ, RTFM, STFW. Or FOAD, luser. > […] > One thing is sure: if aDescendants is an element (as seems likely, but > without a full example that's just a guess) the calls to > getElementsByName and to getElementByID won't work. These are methods > that are part of the document interface, not the element interface. getElementsByName() is a method of the *Document* (HTML5+) and *HTMLDocument* (W3C DOM Level 2 HTML, for [X]HTML < 5) interfaces only. There is no getElementByID() method in the W3C DOM, which is probably the reason why the call fails. getElementById(), however (note the letter case), is and has always been a method of the *Document* interface. [“Note: The getElementById() method is not on elements for compatibility with older versions of jQuery. …” – WTF?] ___________ ¹ Thanks to the people at dict.leo.org for the approximate translation of the German original, „Auf einen groben Klotz gehört ein grober Keil“. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.