🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Dynamiczne dodawanie wiersza tabeli

#39237
From: ethanak
Date: Wed, 29 Mar 2006 07:03
37 lines
2129 bytes
talthen.z-serwera.o2@nospam.pl napisał(a):
> Witam,
> Oto kod JS:
> 
> var gdzie=document.getElementById('morefields');
> var newline='<tr><td><input type="checkbox"><td>1<td><input 
> type="text"><td><input type="text"><td><input type="checkbox">'
> +'<td><input type="text"><td><input type="text"><td><input 
> type="text"></tr>';
> gdzie.appendData(newline);
> 
> Oto fragment htmla:
> <table id="morefields">
> 
> I teraz pytanie- jak to zrobic, zeby to dzialalo?

Po pierwsze: appendData jest dla typu text.
Po drugie - musisz mieć tbody (nie chce mi się wyjaśniać dlaczego), 
czyli najprościej by było:

<table>
<tbody id="morefields">

I dalej na przykład:

var gdzie=document.getElementById('morefields');
var newline='<td>....'; /* bez tr */
var tr=document.createElement('tr');
tr.innerHTML=newline;
gdzie.appendChild(tr);

ethanak
-- 
mailto=window.atob('ZXRoYW5ha0Bwb2xpcC5jb20=');
/* Pisze człowiek ambitnie, a tu przychodzi prostak i wszystko rozumie.
    To jest ewidentna bezczelność!
                                                S. Friedmann/J. Kofta */
Technical Details
Message-ID: <e0dbgc$248$1@news.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.cyf-kr.edu.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
References: <e0btiv$i1u$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.cyf-kr.edu.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
From: ethanak <sweethanak@buziaczek.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Dynamiczne dodawanie wiersza tabeli
Date: Wed, 29 Mar 2006 09:03:57 +0200
Organization: Onet.pl
Lines: 37
Message-ID: <e0dbgc$248$1@news.onet.pl>
References: <e0btiv$i1u$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: router.setia.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1143615820 2184 62.233.231.6 (29 Mar 2006 07:03:40 GMT)
X-Complaints-To: usenet@news.onet.pl
NNTP-Posting-Date: Wed, 29 Mar 2006 07:03:40 +0000 (UTC)
X-Sender: LtZRKpKnjJ7oi47KrfGVYIjKHbt52Na0
In-Reply-To: <e0btiv$i1u$1@nemesis.news.tpi.pl>
X-Accept-Language: pl, en-us, en
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050923 Thunderbird/1.0.7 Mnenhy/0.7.3.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit