...

View Full Version : Problems in accessing multiple fields having same name using javascript



sundeeppalavall
04-06-2009, 06:42 AM
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>';
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum