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


Groups > comp.lang.javascript > #22708

Re: How do I best find the last anchor under a table with id=filer

Message-ID <14487076.kciktWhI2T@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2014-01-19 05:44 +0100
Subject Re: How do I best find the last anchor under a table with id=filer
Newsgroups comp.lang.javascript
References <lbeh71$38c$1@dont-email.me> <83b86ec2-d252-45bb-a302-df2115ee86f4@googlegroups.com> <lbes9n$to6$2@dont-email.me>

Show all headers | View raw


Denis McMahon wrote:

> On Sat, 18 Jan 2014 11:46:19 -0800, Danny wrote:
>> To Tony Johansson
>> 
>> based on your markup structure
>> 
>> var tbl = document.getElementById('filer'),
>> lastLink =
>> tbl.rows[tbl.rows.length-1].document.getElementsByTagName('a')[0]
> 
> I don't think this needs the document in the second statement:

Does not *need*?  Objects implementing the HTMLTableRow interface simply do 
not have a “document” property in any known DOM implementation.

As a result, the property access results in “undefined” (if that), and this 
unsurprisingly completely clueless code, by the incorrigible “Danny” 
Googlodyte-wannabe haunting this newsgroup again, results in a *runtime 
error* (TypeError).
 
> […]
> Or even:
> 
> links=document.getElementById('filer').getElementsByTagName('a');
> lastLink=links[links.length-1];

The only one of your suggestions that makes sense, with you knowing nothing 
about the table structure.  However, it should be

  var links = …;
  var lastLink = …;

-- 
PointedEars

Twitter: @PointedEars2
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

How do I best find the last anchor under a table with id=filer "Tony Johansson" <johansson.andersson@telia.com> - 2014-01-18 19:29 +0100
  Re: How do I best find the last anchor under a table with id=filer "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-18 20:28 +0100
  Re: How do I best find the last anchor under a table with id=filer Danny <dann90038@gmail.com> - 2014-01-18 11:46 -0800
    Re: How do I best find the last anchor under a table with id=filer Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-18 21:39 +0000
      Re: How do I best find the last anchor under a table with id=filer Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-19 05:44 +0100
  Re: How do I best find the last anchor under a table with id=filer Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-18 21:24 +0000
    Re: How do I best find the last anchor under a table with id=filer Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-19 05:32 +0100
      Re: How do I best find the last anchor under a table with id=filer John Harris <niam@jghnorth.org.uk.invalid> - 2014-01-20 15:34 +0000
        Re: How do I best find the last anchor under a table with id=filer "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-20 16:38 +0100
      Re: How do I best find the last anchor under a table with id=filer John Harris <niam@jghnorth.org.uk.invalid> - 2014-01-20 15:54 +0000
  Re: How do I best find the last anchor under a table with id=filer RobG <rgqld@iinet.net.au> - 2014-01-19 16:40 +1000
  Re: How do I best find the last anchor under a table with id=filer JJ <duh@nah.meh> - 2014-01-19 19:07 +0700
    Re: How do I best find the last anchor under a table with id=filer Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-19 21:56 +0100

csiph-web