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


Groups > comp.lang.javascript > #14635

Re: Indexing DOM Elements

From Dr J R Stockton <reply1225@merlyn.demon.co.uk.not.invalid>
Newsgroups comp.lang.javascript
Subject Re: Indexing DOM Elements
Date 2012-06-23 20:16 +0100
Organization Home
Message-ID <NymMV7HFYh5PFwdM@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <1cj7u7ta6tl66bmkmkqt3asr5lkh82ps7r@4ax.com>

Show all headers | View raw


In comp.lang.javascript message <1cj7u7ta6tl66bmkmkqt3asr5lkh82ps7r@4ax.
com>, Thu, 21 Jun 2012 18:48:39, Gene Wirchenko <genew@ocis.net> posted:


>     I am digging into the DOM more.  I am using "Internet & World
>Wide Web How to Program, 4th ed." by Deitel and Deitel.  Section 13.4
>has a very simple drawing program.  It establishes a 100x100 table of
>cells to draw in.  It uses onmousemove to do its drawing.  The drawing
>is on cell at a time and only on the cell that the event fires for.
>
>     What I would like to know is how to refer to any of the cells
>directly.  For example, I would like to click on two points and have
>the line between the two points drawn.  To do that, I would have to
>directly access the cells of the table.
>
>     How do I do this?  What is it called?

Antiquated?  If you actually need to draw, use a canvas (not IE8), for
which see <http://www.merlyn.demon.co.uk/js-grphx.htm>; or use SVG,
about which I happily know approximately nothing.  To find cells on your
line, use Bresenham's line algorithm.

Parts of <http://www.merlyn.demon.co.uk/js-date6.htm> include locating a
click in an HTML table or similar.  One way is to give each sensitive
element a property of the form Axy, where x & y are its coordinates.

An Amazon search suggests to me that the Deitels may be professional
book authors; you can consider the possible implications.

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

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


Thread

Indexing DOM Elements Gene Wirchenko <genew@ocis.net> - 2012-06-21 18:48 -0700
  Re: Indexing DOM Elements Matt McDonald <matt@fortybelow.ca> - 2012-06-21 21:31 -0600
  Re: Indexing DOM Elements Dr J R Stockton <reply1225@merlyn.demon.co.uk.not.invalid> - 2012-06-23 20:16 +0100

csiph-web