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


Groups > comp.lang.javascript > #22705

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

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: How do I best find the last anchor under a table with id=filer
Date 2014-01-18 21:39 +0000
Organization A noiseless patient Spider
Message-ID <lbes9n$to6$2@dont-email.me> (permalink)
References <lbeh71$38c$1@dont-email.me> <83b86ec2-d252-45bb-a302-df2115ee86f4@googlegroups.com>

Show all headers | View raw


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:

var tbl = document.getElementById('filer'),
lastLink = tbl.rows[tbl.rows.length-1].getElementsByTagName('a')[0];

You could also:

r = document.getElementById('filer').rows;
lastLink = r[r.length-1].getElementsByTagName('a')[0];

Or even:

links=document.getElementById('filer').getElementsByTagName('a');
lastLink=links[links.length-1];

-- 
Denis McMahon, denismfmcmahon@gmail.com

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