PDA

View Full Version : Dynamic Select List Problem


vkkumar
09-04-2006, 08:00 AM
I Do Not Know Where I am going WRONG . . .

I am facing a problem as mentioned below -

I have a "myscripts.js" file in which there is a function which adds a row to a table on the fly with form elements like checkbox, file input etc.

I want to add a listbox which has numbers 1 to 100 - to that row of the TABLE.

The code in my "myscripts.js" file is somewhat as shown below -


function addRowToTable(num)
{
if (hasLoaded) {
var tbl = document.getElementById(TABLE_NAME);
var nextRow = tbl.tBodies[0].rows.length;
var iteration = nextRow + ROW_BASE;
if (num == null) {
num = nextRow;
} else {
iteration = num + ROW_BASE;
}



// add the row
var row = tbl.tBodies[0].insertRow(num);

//*************** THE PROBLEM AREA *****************

var cell0 = row.insertCell(0);
var qtEl = document.createElement('select');
qtEl.setAttribute('name', 'myqty' + iteration);

for(var j=1;j<=100;i++) {
var qtOption=document.createElement('OPTION');
var qtText=document.createTextNode(j);
qtOption.appendChild(qtText);
qtOption.setAttribute('value',j);
qtEl.appendChild(qtOption);
}

cell0.appendChild(qtEl);


}
}

Please hep me . . .

Thank You

Kravvitz
09-04-2006, 08:43 AM
In what way is that not working how you expect it to?

I suggest you read this: http://www.thunderguy.com/semicolon/2005/05/23/setting-the-name-attribute-in-internet-explorer/

P.S. Please read Guidelines and Suggestions for Posting on Web Development Forums (http://www.dynamicsitesolutions.com/other/forum_posting_guidelines/).