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


Groups > comp.lang.javascript > #26790

Re: Question about appendChild using series of divs

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Question about appendChild using series of divs
Date Wed, 04 Feb 2015 14:23:52 +0100
Organization PointedEars Software (PES)
Lines 63
Message-ID <20656658.1E4ZlvUoOU@PointedEars.de> (permalink)
References <mar78t$fq8$1@panix3.panix.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1423056277 13409 eJwFwYEBACAEBMCVxHsZJ8n+I3TnxsUboBM+PsMe4kmc0qDUjuLNlvTHY1oySGCEsQy6+wMfZhCr (4 Feb 2015 13:24:37 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Wed, 4 Feb 2015 13:24:37 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwFwYEBwCAIA7CXhJbCzkGm/59gEpBpkgoxblzjsR0sVVz0kPhxOkW6K6cVXFjyHvhnmbZ13GoRhqn0ByRNE6I=
Cancel-Lock sha1:bkUG096t5oUzlsF0e8TZZ9weR0k=
X-NNTP-Posting-Host eJwNycERwDAIA7CVyIGNGSeFY/8RGn0F52FnEAwsVlnh2iu0dW4XU1fHNR/lUwbY6xIMrMEPDHgQQw==
Xref csiph.com comp.lang.javascript:26790

Show key headers only | View raw


Gordon wrote:
^^^^^^
Please use your full (real) name.

> Context: I am using the most recent Firefox browser
> on a Linux (Ubuntu 14.04) box.  I am constructing a
> page where, when the user clicks on a picture,
> related pictures appear under it, pushing subsequent
> material down.

The proper term is “document”, not “page”.

> […]  In all five cases I use appendChild to attach the div
> to the 'H' div.  The divs then display in the same order.
> (I would think they would display in reverse order,

Unfounded.

> since they are being successively appended to 'H', not
> to the last appended, but they don't.)

“Append” means “to insert at the end” (cf. “prepend”).

> While the page is up, if the user clicks on a link within
> one of the five divs, say 'C', another set of divs is similarly
> created, let us say 'c1', 'c2', 'c3', ....  These I append
> to div 'C'.  I want them to appear below 'C' and before 'D',
> but instead they display below 'E'.

You must have appended them to 'H' instead.

> My questions are (1) Why, if appending after 'H' works
> as I expect, don't the other appendChild calls?

Impossible to say, all crystal balls are under repair.
But this Magic 8-ball here says: “Concentrate and ask again”.

> and
> (2) How can I get the result I want?

Well, you *could* try running three magic rounds around the larch at 
midnight when the moon is full.

> Note: I don't want to do the work of locating these items on the
> page by numerical coordinates, I want the browser to
> do that work, so the divs will respond to possible
> changes in the size for foregoing material.  If
> possible.

The browser will do the right thing if you tell it right.

> Thanks for any help or suggestions you can give.

  Talk is cheap. Show me the code.
    —Linus Torvalds

See also the FAQ.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


Thread

Question about appendChild using series of divs gcf@panix.com (Gordon) - 2015-02-03 14:24 -0500
  Re: Question about appendChild using series of divs JJ <jj4public@vfemail.net> - 2015-02-04 07:10 +0700
    Re: Question about appendChild using series of divs gcf@panix.com (Gordon) - 2015-02-05 18:02 +0000
  Re: Question about appendChild using series of divs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-04 14:23 +0100
    Re: Question about appendChild using series of divs Tim Streater <timstreater@greenbee.net> - 2015-02-04 13:34 +0000
      Re: Question about appendChild using series of divs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-04 15:12 +0100
    Re: Question about appendChild using series of divs gcf@panix.com (Gordon) - 2015-02-05 17:59 +0000
      Re: Question about appendChild using series of divs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-05 19:21 +0100
        Re: Question about appendChild using series of divs John Harris <niam@jghnorth.org.uk.invalid> - 2015-02-05 19:36 +0000
          Re: Question about appendChild using series of divs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-07 12:07 +0100
            Re: Question about appendChild using series of divs John Harris <niam@jghnorth.org.uk.invalid> - 2015-02-07 15:20 +0000

csiph-web