0

i am using this function to add rows dynamically

function addRow()
{
  var tbl = document.getElementById('applications');
  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 el = document.createElement('input');
  el.type = 'text';
  el.name = 'txtRow' + iteration;
  el.id = 'txtRow' + iteration;
  el.size = 45;
  //e1.style.color='blue'
 // e1.className="cellData";
  //e1.style.width="220px";
  //e1.maxlength=20;
  //alert("hi")

  //e1.style.height=17px;
   cellLeft.appendChild(el);
}

when i try to use these :

//e1.style.color='blue'
 // e1.className="cellData";
  //e1.style.width="220px";
  //e1.maxlength=20;
 //e1.style.height=17px;

it stops working...

can some one guide me..
i really need to add styles etc to the rows added

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by aashishn86
0

Aashishn86,

All the non-working statements contain typos.

Change e1. to el. all through.

Airshow

0

ya thanks........
had figured that out...... :)
they look so damn similar.....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.