Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30377

Re: Using getElementsByName on a DIV ?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Using getElementsByName on a DIV ?
Date Thu, 28 Apr 2016 01:10:48 +0100
Organization A noiseless patient Spider
Lines 50
Message-ID <877ffi619z.fsf@bsb.me.uk> (permalink)
References <571e5590$0$5835$e4fe514c@news.xs4all.nl> <getElementsByTagName-20160425193302@ram.dialup.fu-berlin.de> <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>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="25249"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RMIqBu20aYCx5mznLdFTxjstpnaw2HVU="
Cancel-Lock sha1:VJT0r9Rf1Bw9HQtQdxgFX51pGNA= sha1:/teq2WB4dAbCVa76pnfvzO9g/Qs=
X-BSB-Auth 1.2d2e4e77e5b6b70e0b59.20160428011048BST.877ffi619z.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:30377

Show key headers only | View raw


"R.Wieser" <address@not.available> writes:
<snip>

>> If there is something else not working, please give an example document.
>
> Well, I tried to do that (just not as a cut-and-paste one), and it got
> pretty-much ignored.

Maybe you are not sure what a document is?  It's the full HTML (often
called a page) along with the script that is going wrong.  That's often
part of the document, but if it isn't you'd have to provide that as
well.

> 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 ...

This isn't an example document.  One trouble with being a beginner is
that you may not know where the problem is, which is why a complete
self-contained example is so important.

Without one, all I can do is guess -- maybe there are no img elements in
this.parentNode?  Maybe 'this' is bound to the wrong type of object?
How many guesses do you want people to make before you simply provide a
document (and code) that exhibits the problem?

Just to be clear, I've cut and pasted your lines into a minimal document
and it does what I think you want.  The problem (whatever it is) is
elsewhere.

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.

<snip>
-- 
Ben.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-25 19:37 +0200
  Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-25 20:57 +0200
    Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-25 20:10 +0100
      Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-25 21:42 +0200
        Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-25 23:07 +0100
          Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 09:32 +0200
            Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-26 11:28 +0100
              Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 14:52 +0200
                Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-26 14:40 +0100
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 18:37 +0200
                Re: Using getElementsByName on a DIV ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-04-26 19:12 +0200
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 20:44 +0200
                Re: Using getElementsByName on a DIV ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-26 19:17 +0200
                Re: Using getElementsByName on a DIV ? Stefan Weiss <krewecherl@gmail.com> - 2016-04-26 19:56 +0200
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 22:11 +0200
                Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-26 19:40 +0100
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 21:43 +0200
                Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-27 00:14 +0100
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-27 11:05 +0200
                Re: Using getElementsByName on a DIV ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-28 01:10 +0100
                Re: Using getElementsByName on a DIV ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-05 00:46 +0200
                Re: Using getElementsByName on a DIV ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-05-06 12:56 +0200
                Re: Using getElementsByName on a DIV ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-05-06 05:14 -0700
                Re: Using getElementsByName on a DIV ? John Harris <niam@jghnorth.org.uk.invalid> - 2016-05-05 14:36 +0100
                Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 20:38 +0200
        Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 08:57 +0200
  Re: Using getElementsByName on a DIV ? Stefan Weiss <krewecherl@gmail.com> - 2016-04-25 23:41 +0200
    Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 08:59 +0200
  Re: Using getElementsByName on a DIV ? JJ <jj4public@vfemail.net> - 2016-04-26 19:03 +0700
    Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-26 14:56 +0200
    Re: Using getElementsByName on a DIV ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-26 20:13 +0200
      Re: Using getElementsByName on a DIV ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-26 20:19 +0200
  Re: Using getElementsByName on a DIV ? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-04-26 23:30 +0100
    Re: Using getElementsByName on a DIV ? "R.Wieser" <address@not.available> - 2016-04-27 09:29 +0200
    Re: Using getElementsByName on a DIV ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-04-27 10:34 +0200
    Re: Using getElementsByName on a DIV ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-05-04 19:04 -0700

csiph-web