🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #39469

Re: jak to zrobic obiektowo

#39469
From: porneL
Date: Thu, 20 Apr 2006 11:16
26 lines
1845 bytes
On Tue, 18 Apr 2006 10:10:58 +0100, Marek <mrb@pl-net.pl> wrote:

> Jednak niestety mam problem, którego nie umiem w ten sposób rozwiazac.
> Chodzi o to ze elementy ktorymi manipuluje to komorki tabeli obdarzone
> identyfikatorami (w skrócie mozna-by to opisac tak :
> <table>
> <tr><td id="L1W1"> tekst jakis</td><td id="L1W2"> tekst jakis</td>  ...

Litości! getElementById() to nie jest jeden jedyny sposób odwoływania się  
do node'ów dokumentu!

Przy prostych tabelach można użyć conajmniej drugi co do popularności  
getElementsByTagName:

tabela.getElementsByTagName('tr')[rzad].getElementsByTagName('td')[komorka]

DOM HTML jeszcze ma kolekcje typu rows/cells  
(http://www.w3.org/TR/DOM-Level-2-HTML/)
table.tBodies[0].rows[rzad].cells[komorka]

A przy złożonych przypadkach można sobie przeskanować tabela.childNodes i  
zapisać referencje np. w 2-wymiarowej tablicy.

-- 
* html {redirect-to: url(http://kurs.browsehappy.pl);}
this.author = new Geek("porneL");
Technical Details
Message-ID: <op.s8az9tqofux2e6@pornel.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <e1rnpq$kh7$1@atlantis.news.tpi.pl> <1145228679.832898.77240@v46g2000cwv.googlegroups.com> <e22aig$qi9$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: porneL <niusy@pornel.net>
Newsgroups: pl.comp.lang.javascript
Subject: Re: jak to zrobic obiektowo
Date: Thu, 20 Apr 2006 12:16:31 +0100
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 26
Message-ID: <op.s8az9tqofux2e6@pornel.net>
References: <e1rnpq$kh7$1@atlantis.news.tpi.pl> <1145228679.832898.77240@v46g2000cwv.googlegroups.com> <e22aig$qi9$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: pornel.plus.com
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1145531804 15051 84.92.248.233 (20 Apr 2006 11:16:44 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Thu, 20 Apr 2006 11:16:44 +0000 (UTC)
X-User: pornelspam
User-Agent: Opera Mail(BETA2)/9.00 (MacPPC)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit