faraz
02-27-2009, 05:26 AM
function addRow()
{
//add a row to the rows collection and get a reference to the newly added row
var newRow = document.all("tablename").insertRow();
//add 5 cells (<td>) to the new row and set the innerHTML to contain text boxes
var tbl = document.getElementById("tablename");
var tot = tbl.tBodies[0].rows.length-1;
var tempcounter;
tempcounter = "<input type='text' size='1' style='font-weight:bold; color:#03C' ";
tempcounter += " style='border:none;' value= ";
tempcounter += tot;
tempcounter += " READONLY>";
alert(tot);
var oCell = newRow.insertCell();
oCell.innerHTML = tempcounter;
oCell.height="43"
oCell.align = "center";
oCell = newRow.insertCell();
oCell.innerHTML = "Name"+tempcounter;
oCell.style.fontWeight = "bold";
oCell.style.color = "#03C";
oCell.height="43"
oCell.align = "center";
var oCellsel = newRow.insertCell();
oCellsel.align = "center";
oCellsel.height="43"
var txtInp3 = document.createElement('select');
txtInp3.name = 'NamrList'+ tempcounter;
txtInp3.id = 'NamrList'+ tempcounter;
txtInp3.options[0] = new Option('None', 'value0');
txtInp3.options[1] = new Option('Megha Bhatnagar', 'value1');
txtInp3.options[2] = new Option('Megha ', 'value2');
txtInp3.options[3] = new Option('Mamta', 'value3');
txtInp3.options[4] = new Option('Shalini', 'value4');
txtInp3.options[5] = new Option('Suchitra', 'value5');
oCellsel.appendChild(txtInp3); //here i want to fetch list from database
var oCell = newRow.insertCell();
oCell.align = "center";
oCell.height="43"
var txtInp4 = document.createElement('input');
txtInp4.id = 'JoinDate'+ tempcounter;
txtInp4.setAttribute('type', 'text');
txtInp4.setAttribute('name', 'JoinDate'+ tempcounter );
txtInp4.setAttribute('size', '9');
txtInp4.setAttribute('value', '');
oCell.appendChild(txtInp4);
var oCell = newRow.insertCell();
oCell.align = "center";
oCell.height="43"
var txtInp4 = document.createElement('input');
txtInp4.id = 'ReleaseDate'+ tempcounter;
txtInp4.setAttribute('type', 'text');
txtInp4.setAttribute('name', 'ReleaseDate'+ tempcounter );
txtInp4.setAttribute('size', '10');
txtInp4.setAttribute('value', ''); // iteration included for debug purposes
oCell.appendChild(txtInp4);
}
I want list in oCellSel to come from database what should i do anybody please help...!!-------------
{
//add a row to the rows collection and get a reference to the newly added row
var newRow = document.all("tablename").insertRow();
//add 5 cells (<td>) to the new row and set the innerHTML to contain text boxes
var tbl = document.getElementById("tablename");
var tot = tbl.tBodies[0].rows.length-1;
var tempcounter;
tempcounter = "<input type='text' size='1' style='font-weight:bold; color:#03C' ";
tempcounter += " style='border:none;' value= ";
tempcounter += tot;
tempcounter += " READONLY>";
alert(tot);
var oCell = newRow.insertCell();
oCell.innerHTML = tempcounter;
oCell.height="43"
oCell.align = "center";
oCell = newRow.insertCell();
oCell.innerHTML = "Name"+tempcounter;
oCell.style.fontWeight = "bold";
oCell.style.color = "#03C";
oCell.height="43"
oCell.align = "center";
var oCellsel = newRow.insertCell();
oCellsel.align = "center";
oCellsel.height="43"
var txtInp3 = document.createElement('select');
txtInp3.name = 'NamrList'+ tempcounter;
txtInp3.id = 'NamrList'+ tempcounter;
txtInp3.options[0] = new Option('None', 'value0');
txtInp3.options[1] = new Option('Megha Bhatnagar', 'value1');
txtInp3.options[2] = new Option('Megha ', 'value2');
txtInp3.options[3] = new Option('Mamta', 'value3');
txtInp3.options[4] = new Option('Shalini', 'value4');
txtInp3.options[5] = new Option('Suchitra', 'value5');
oCellsel.appendChild(txtInp3); //here i want to fetch list from database
var oCell = newRow.insertCell();
oCell.align = "center";
oCell.height="43"
var txtInp4 = document.createElement('input');
txtInp4.id = 'JoinDate'+ tempcounter;
txtInp4.setAttribute('type', 'text');
txtInp4.setAttribute('name', 'JoinDate'+ tempcounter );
txtInp4.setAttribute('size', '9');
txtInp4.setAttribute('value', '');
oCell.appendChild(txtInp4);
var oCell = newRow.insertCell();
oCell.align = "center";
oCell.height="43"
var txtInp4 = document.createElement('input');
txtInp4.id = 'ReleaseDate'+ tempcounter;
txtInp4.setAttribute('type', 'text');
txtInp4.setAttribute('name', 'ReleaseDate'+ tempcounter );
txtInp4.setAttribute('size', '10');
txtInp4.setAttribute('value', ''); // iteration included for debug purposes
oCell.appendChild(txtInp4);
}
I want list in oCellSel to come from database what should i do anybody please help...!!-------------