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

Recommended Answers

All 2 Replies

Aashishn86,

All the non-working statements contain typos.

Change e1. to el. all through.

Airshow

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.