Var customerInfoMethod = {
// Copy and Add rows
Copyrow: function (obj, id)
{
Var rowIndex = obj. parentNode. parentNode. rowIndex;
Var resrow = document. getElementById (id );
RowIndex --;
Var newRow = resrow. cloneNode (true); // document. createElement ("tr ");
Var parent = resrow. parentNode;
If (parent. lastChild = resrow ){
// If targetElement is the last child element of parent, insert newElement
Parent. appendChild (newRow );
} Else {
// If not, insert it to the front of the next sibling node of targetElement.
Parent. insertBefore (newRow, resrow. nextSibling );
}
// NewRow. innerHTML = resrow. innerHTML;
Var selectObj = newRow. getElementsByTagName ("select ");
For (var a = 0; a <selectObj. length; a ++ ){
SelectObj [a]. options [0]. selected = true;
}
Var inputObj = newRow. getElementsByTagName ("input ");
InputObj [0]. style. display = "";
InputObj [1]. style. display = "none ";
},
// Copy and Add rows
CopyrowUpdate: function (obj, id)
{
Var rowIndex = obj. parentNode. parentNode. rowIndex;
Var resrow = document. getElementById (id );
RowIndex --;
Var newRow = resrow. cloneNode (true); // document. createElement ("tr ");
Var parent = resrow. parentNode;
If (parent. lastChild = resrow ){
// If targetElement is the last child element of parent, insert newElement
Parent. appendChild (newRow );
} Else {
// If not, insert it to the front of the next sibling node of targetElement.
Parent. insertBefore (newRow, resrow. nextSibling );
}
// NewRow. innerHTML = resrow. innerHTML;
Var selectObj = newRow. getElementsByTagName ("select ");
For (var a = 0; a <selectObj. length; a ++ ){
SelectObj [a]. options [0]. selected = true;
}
Var inputObj = newRow. getElementsByTagName ("input ");
For (var I = 0; I <inputObj. length-2; I ++ ){
InputObj [I]. value = "0 ";
}
InputObj [inputObj. length-2]. style. display = "";
InputObj [inputObj. length-1]. style. display = "none ";
},
// Delete a row
DeleteRow: function (rootId, obj ){
Var rootTable = $ (rootId );
RootTable. deleteRow (obj. parentNode. parentNode. rowIndex );
}
}
/**
Add line fanjf
*/
Function addRow (tableId, trId ){
Var tableObj = document. getElementById (tableId );
Var trObj = document. getElementById (trId );
// Var trIndex = trObj. rowIndex + 1;
Var rows = tableObj. rows. length;
Var cell = "";
Var tr = tableObj. insertRow (rows );
For (I = 0; I <trObj. cells. length; I ++ ){
Cell = tableObj. rows (rows). insertCell (I );
Cell. innerText = trObj. cells (I). innerText;
Cell. className = trObj. cells (I). className;
Cell. innerHTML = trObj. cells (I). innerHTML;
}
}
/**
Delete line fanjf
*/
Function deleteRow (tableId, trId ){
Var tableObj = document. getElementById (tableId );
Var trObj = document. getElementById (trId );
// Var trIndex = trObj. rowIndex; // copy the row number of the tr.
Var rows = tableObj. rows. length;
If (rows> 0 ){
TableObj. deleteRow (rows-1 );
} Else {
Alert ("No deleted card number information! ");
}
}