Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35457
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: addEventListener question |
| Date | Sat, 11 Aug 2018 16:30:42 +0200 |
| Organization | solani.org |
| Lines | 35 |
| Message-ID | <pkmrug$t0d$1@solani.org> (permalink) |
| References | <5b6dbba7$0$2957$e4fe514c@news.xs4all.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | solani.org 1533997840 29709 127.0.0.43 (11 Aug 2018 14:30:40 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Sat, 11 Aug 2018 14:30:40 +0000 (UTC) |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
| X-User-ID | eJwFwYEBwCAIA7CXRGgL5zjQ/09YAqexFQQDD283pxLBWyPBmqGDyTpapyJ9W+t+Hhwst/4BCxYQVQ== |
| Content-Language | de-DE |
| Cancel-Lock | sha1:4PkYkS70YkNUwcPdxnVIvmrcl14= |
| In-Reply-To | <5b6dbba7$0$2957$e4fe514c@news.xs4all.nl> |
| Xref | csiph.com comp.lang.javascript:35457 |
Show key headers only | View raw
On 10.08.2018 at 18:21, Luuk wrote:
> Considering this piece of HTML:
> ....
> <dl id="csschart">
>
> <dt>001</dt>
> <dd class="p22"><span><b>22</b></span></dd>
> <dd class="sub p10" ><span><b>10</b></span></dd>
>
> <dt>002</dt>
> <dd class="p45"><span><b>45</b></span></dd>
> <dd class="sub p35"><span><b>36</b></span></dd>
>
> ....
>
>
> and this piece of javascript:
> var links = document.getElementById('csschart').children;
> var index;
> var abc = -1;;
> for (index = 0; index < links.length; ++index) {
> if (links[index].innerHTML== links[index].innerText) { abc++; }
I'd prefer (assuming HTML):
if (links[index].tagName === "DT") { abc++; }
> links[index].addEventListener('click',function(e) {
> alert(abc);
> });
> }
--
Christoph M. Becker
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
addEventListener question Luuk <luuk@invalid.lan> - 2018-08-10 18:21 +0200
Re: addEventListener question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-11 00:04 +0200
Re: addEventListener question Luuk <luuk@invalid.lan> - 2018-08-11 14:28 +0200
Re: addEventListener question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-08-11 14:53 +0100
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-11 16:27 +0200
Re: addEventListener question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-08-12 17:49 +0200
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-12 18:05 +0200
Re: addEventListener question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-08-12 18:42 +0200
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-12 19:38 +0200
Re: addEventListener question Julio Di Egidio <julio@diegidio.name> - 2018-08-12 11:12 -0700
Re: addEventListener question James Kirk <noneya.invalid@gmail.com> - 2018-08-12 22:36 -0400
Re: addEventListener question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-06 08:17 +0200
Re: addEventListener question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-13 11:50 +0200
Re: addEventListener question Luuk <luuk@invalid.lan> - 2018-08-18 16:50 +0200
Re: addEventListener question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-11 16:58 +0200
Re: addEventListener question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-08-12 02:40 +0100
Re: addEventListener question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-12 09:07 +0200
Re: addEventListener question Luuk <luuk@invalid.lan> - 2018-08-11 19:17 +0200
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-11 16:30 +0200
Re: addEventListener question Luuk <luuk@invalid.lan> - 2018-08-11 19:12 +0200
Re: addEventListener question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-08-12 17:46 +0200
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-12 18:06 +0200
Re: addEventListener question "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-08-12 18:12 +0200
Re: addEventListener question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-08-12 18:33 +0200
Re: addEventListener question Luuk <luuk@invalid.lan> - 2018-08-18 17:01 +0200
csiph-web