Style New Rows Added By Ajax Code

Javascript coding ..

Moderators: macek, egami, gesf

ehauser
New php-forum User
New php-forum User
Posts: 39
Joined: Fri Sep 23, 2011 5:02 am
Location: U.S.A.
Contact:

Style New Rows Added By Ajax Code

Postby ehauser » Tue Oct 18, 2011 5:18 am

Hello,

I would like to be able to style the inputs that are added to new rows with the Ajax code I have. I have the size set in the code for each input, but it does not read that. The code for this is:

Code: Select all

<script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('partsordered');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
 
// left cell
//var cellLeft = row.insertCell(0);
//var textNode = document.createTextNode(iteration);
//cellLeft.appendChild(textNode);


// right cell0
var cellLeft = row.insertCell(0);
var el = document.createElement('input');
el.type = 'text';
el.name = 'quantity' + iteration;
el.id = 'quantity' + iteration;
el.size = 10;

cellLeft.appendChild(el);

// right cell1
var cellRight1 = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'partnumber' + iteration;
el.id = 'partnumber' + iteration;
el.size = 20;

cellRight1.appendChild(el);

// right cell2
var cellRight2 = row.insertCell(2);
var el = document.createElement('input');
el.type = 'text';
el.name = 'legs' + iteration;
el.id = 'legs' + iteration;
el.size = 20;

cellRight2.appendChild(el);

// right cell3
var cellRight3 = row.insertCell(3);
var el = document.createElement('input');
el.type = 'text';
el.name = 'color' + iteration;
el.id = 'color' + iteration;
el.size = 20;

cellRight3.appendChild(el);

// right cell4
var cellRight4 = row.insertCell(4);
var el = document.createElement('input');
el.type = 'text';
el.name = 'expstend' + iteration;
el.id = 'expstend' + iteration;
el.size = 20;

cellRight4.appendChild(el);

// right cell5
var cellRight5 = row.insertCell(5);
var el = document.createElement('input');
el.type = 'text';
el.name = 'colorcode' + iteration;
el.id = 'colorcode' + iteration;
el.size = 20;

cellRight5.appendChild(el);
 
// right cell6
var cellRight6 = row.insertCell(6);
var el = document.createElement('input');
el.type = 'text';
el.name = 'hardware' + iteration;
el.id = 'hardware' + iteration;
el.size = 20;

cellRight6.appendChild(el);

// right cell7
var cellRight7 = row.insertCell(7);
var el = document.createElement('input');
el.type = 'text';
el.name = 'specialupright' + iteration;
el.id = 'specialupright' + iteration;
el.size = 20;

cellRight7.appendChild(el);

// right cell8
var cellRight8 = row.insertCell(8);
var el = document.createElement('input');
el.type = 'text';
el.name = 'esc' + iteration;
el.id = 'esc' + iteration;
el.size = 20;

cellRight8.appendChild(el);

// right cell9
var cellRight9 = row.insertCell(9);
var el = document.createElement('input');
el.type = 'text';
el.name = 'options' + iteration;
el.id = 'options' + iteration;
el.size = 20;

cellRight9.appendChild(el);

// right cell10
var cellRight10 = row.insertCell(10);
var el = document.createElement('input');
el.type = 'text';
el.name = 'df' + iteration;
el.id = 'df' + iteration;
el.size = 20;

cellRight10.appendChild(el);

// right cell11
var cellRight11 = row.insertCell(11);
var el = document.createElement('input');
el.type = 'text';
el.name = 'top' + iteration;
el.id = 'top' + iteration;
el.size = 20;

cellRight11.appendChild(el);

// right cell12
var cellRight12 = row.insertCell(12);
var el = document.createElement('input');
el.type = 'text';
el.name = 'back' + iteration;
el.id = 'back' + iteration;
el.size = 20;

cellRight12.appendChild(el);

// right cell13
var cellRight13 = row.insertCell(13);
var el = document.createElement('input');
el.type = 'text';
el.name = 'bottom' + iteration;
el.id = 'bottom' + iteration;
el.size = 20;

cellRight13.appendChild(el);

// right cell14
var cellRight14 = row.insertCell(14);
var el = document.createElement('input');
el.type = 'text';
el.name = 'shelf' + iteration;
el.id = 'shelf' + iteration;
el.size = 20;

cellRight14.appendChild(el);

// right cell15
var cellRight15 = row.insertCell(15);
var el = document.createElement('input');
el.type = 'text';
el.name = 'compartment' + iteration;
el.id = 'compartment' + iteration;
el.size = 20;

cellRight15.appendChild(el);

// right cell16
var cellRight16 = row.insertCell(16);
var el = document.createElement('input');
el.type = 'text';
el.name = 'upright' + iteration;
el.id = 'upright' + iteration;
el.size = 20;

cellRight16.appendChild(el);

// right cell17
var cellRight17 = row.insertCell(17);
var el = document.createElement('input');
el.type = 'text';
el.name = 'partition' + iteration;
el.id = 'partition' + iteration;
el.size = 20;

cellRight17.appendChild(el);
}

Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest

cron