Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with dynamic addition of rows

Member
 
Join Date: Mar 2009
Location: India
Posts: 52
#1: Jul 7 '09
i am using this function to add rows dynamically

Expand|Select|Wrap|Line Numbers
  1. function addRow()
  2. {
  3.   var tbl = document.getElementById('applications');
  4.   var lastRow = tbl.rows.length;
  5.   // if there's no header row in the table, then iteration = lastRow + 1
  6.   var iteration = lastRow;
  7.   var row = tbl.insertRow(lastRow);
  8.  
  9.   // left cell
  10.   var cellLeft = row.insertCell(0);
  11.   var el = document.createElement('input');
  12.   el.type = 'text';
  13.   el.name = 'txtRow' + iteration;
  14.   el.id = 'txtRow' + iteration;
  15.   el.size = 45;
  16.   //e1.style.color='blue'
  17.  // e1.className="cellData";
  18.   //e1.style.width="220px";
  19.   //e1.maxlength=20;
  20.   //alert("hi")
  21.  
  22.   //e1.style.height=17px;
  23.    cellLeft.appendChild(el);
  24. }
  25.  
  26.  
when i try to use these :
Expand|Select|Wrap|Line Numbers
  1. //e1.style.color='blue'
  2.  // e1.className="cellData";
  3.   //e1.style.width="220px";
  4.   //e1.maxlength=20;
  5.  //e1.style.height=17px;
  6.  
  7.  
it stops working...

can some one guide me..
i really need to add styles etc to the rows added
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#2: Jul 8 '09

re: Problem with dynamic addition of rows


"e1" is not "el" (though they look very similar in Courier fonts)
Member
 
Join Date: Mar 2009
Location: India
Posts: 52
#3: Jul 8 '09

re: Problem with dynamic addition of rows


whew... cool
thanks......... :)
another thing

How can i add a calendar control to this..
i need to add the anchor tag
and javascript functions to it..

thanks :)
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Jul 8 '09

re: Problem with dynamic addition of rows


Try the Dynarch calendar.
Reply


Similar JavaScript / Ajax / DHTML bytes