Web Analytics Made Easy -
StatCounter Problems in accessing multiple fields having same name using javascript - CodingForum

Announcement

Collapse
No announcement yet.

Problems in accessing multiple fields having same name using javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems in accessing multiple fields having same name using javascript

    Hi,

    I have a javascript function which creates a row of elements. when i create 2 or more rows the elements will be having the same name. How can we access all the elements with the same name. please find below the code snippet used to create the row of form elements.

    function addTrackingRow(){
    var newRow = document.getElementById("trackingDetails").insertRow();
    var trackingCells = document.getElementById('trackingDetails').rows[0].cells;

    newCell = newRow.insertCell();
    newCell.innerHTML = trackingCells[0].innerHTML;

    newCell = newRow.insertCell();
    newCell.innerHTML = trackingCells[1].innerHTML;

    newCell = newRow.insertCell();
    newCell.innerHTML = '<td align="center"><input type="text" name="fromTime" id="fromTime" size="4" maxlength="4"/></td>';

    newCell = newRow.insertCell();
    newCell.innerHTML = '<td align="center"><input type="text" name="toTime" id="toTime" size="4" maxlength="4"/></td>';

    newCell = newRow.insertCell();
    newCell.innerHTML = '<td align="center"><textarea rows="03" cols="30" name="desc"></textarea></td>';
    }
Working...
X