Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
( not access dynamic controls when document.getelementbyId('textStopDesc11') a using function what can ı do?)
JavaScript
function AddPlannedStop()
{
    var table = document.getElementById('tblPlannedStop');
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var hidden = document.getElementById("hftblPlannedStoprowCount");
    hidden.value = rowCount;
       
    var btnDeleteIcon = "Images/deleteicon.png";
    var cell1 = row.insertCell(0);
    cell1.innerHTML ="<INPUT id='button" + (rowCount-1) + 0 +
    "' önclick = 'deletePlannedStopRow()' style='WIDTH: 100%;" +
    "BACKGROUND-POSITION: center; BACKGROUND-COLOR: menu;" +
    "BACKGROUND-IMAGE: url(" + btnDeleteIcon + ")' type='button'>"; 
    var cell2 = row.insertCell(1);
    var element2 = document.createElement("input");
    element2.type = "text";
    element2.name = "txtStopDesc" + (rowCount - 1) + 1;
    element2.id = rowCount + 1;
    element2.style.width = "200px";
    cell2.appendChild(element2);
    var cell3 = row.insertCell(2);
    return false;
}
Posted
v2
Comments
Do you see any errors in FireBug console tab?

1 solution

You're setting the name property of the element to "txtStopDesc" + (rowCount - 1) + 1, but you search by Id instead, which is set to rowCount + 1.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900