/    Sign up×
Community /Pin to ProfileBookmark

Arrange cells in a dynamic table

Hi,
I created a dynamic table, witch has a form in it, every row is an input. In the first row a have the file type input, so it is formed by the text box with the file name and the browse button.
In the second row a have a radio button and 3 other text boxes. The radio button it is put right under the file type text box and the other 3 text boxes are put on the same row with the radio button but starting where the browse button above it’s ending.

How do i arrange the cells to be close to eatch other?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonJan 11.2005 — Can I see some code please, I have a feeling that this might be caused by a lack of a colspan attribute but I can't be sure.
Copy linkTweet thisAlerts:
@RoshuauthorJan 11.2005 — I know about the colspan atribut, but can it be used in this situation?

In the picture, the firs 3 line are made by the html form, the next 3 lines are made by the javascript function, so as you can see the text boxes are far from the radio button.

This is the code:

function addInput ()

{

if (document.all || document.getElementById)

{

var table = document.all ? document.all.formElems : document.getElementById('formElems');

var row = table.insertRow(++f);

if (document.all)

{

row = table.insertRow(table.rows.length - 2);

var cell = row.insertCell();

cell.innerHTML ='<INPUT TYPE="file" NAME="fileName' + f + '"' + '>';

row = table.insertRow(table.rows.length - 2);
cell = row.insertCell(0);
cell.innerHTML ='<INPUT type="radio" name="radioBut' + f + '"' + ' value="chkTime">';

cell = row.insertCell(1);
cell.innerHTML ='<input class="form" type="text" name="txtTime_y' + f + '"' + ' size="4" maxlength="4" >';

cell = row.insertCell(2);
cell.innerHTML ='<input class="form" type="text" name="txtTime_m' + f + '"' + ' size="2" maxlength="2">';

cell = row.insertCell(3);
cell.innerHTML ='<input class="form" type="text" name="txtTime_d' + f + '"' + ' size="2" maxlength="2"><b>(yyyy/mm/dd)</

row = table.insertRow(table.rows.length - 2);
cell = row.insertCell();
cell.innerHTML = '<INPUT TYPE="button" VALUE="select another file"' + ' ID="addButton' + f + '"' +' ONCLICK="addInput();

document.all['addButton' + (f-1)].outerHTML = '';
}


[upl-file uuid=8f8eec60-5877-4062-b006-4b405dca6021 size=11kB]pic.jpg[/upl-file]
×

Success!

Help @Roshu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...