Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/07/2008, 09:35
alfil123
 
Fecha de Ingreso: agosto-2005
Mensajes: 722
Antigüedad: 19 años, 2 meses
Puntos: 2
Pregunta una consulta de codigo

una pregunta amigos no entiendo que hace esta funcion, porfavor si alguien puede explicarme


function addRowInnerHTML(id,string_of_tds,ID_insert_service _to_sale,price_after_discount_String,insert_custom er_on_service)
{
tr_id = Date();
array_of_tds = string_of_tds.split('*#*');
length_of_array = array_of_tds.size();
if(id == 'sale_services')
{
var tbody = top.window.document.getElementById(id).getElements ByTagName("TBODY")[0];
}
else
{
var tbody = parent.window.document.getElementById(id).getEleme ntsByTagName("TBODY")[0];
}
//var row = document.createElement('TR style="width:600; height:200;background-color:blue;"')
var row = document.createElement("TR")
row.setAttribute("id",tr_id);
for (var i = 0; i<length_of_array; i++)
{
array_value =array_of_tds[i];
td1 = document.createElement("TD");
//td2 = document.createElement("TD");
//td1.appendChild(document.createTextNode(array_valu e));
if(array_value.startsWith('<cust_id>'))
{
var cust_id = array_value.substring(9);
element = document.createElement("input");
element.setAttribute("name", "aradiobutton");
element.setAttribute("type", "button");
element.setAttribute("value", "Remove");
element.setAttribute("onClick", "removeThisCustomerOnNewSale('"+tr_id+"','"+id+"', '"+cust_id+"')");
td1.appendChild(element);
/*element2 = document.createElement("input");
element2.setAttribute("name", "customer_id[]");
element2.setAttribute("type", "hidden");
element2.setAttribute("value", cust_id);
td2.appendChild(element2);*/
row.appendChild(td1);
//row.appendChild(td2);
}
else if(array_value.startsWith('<service_id>'))
{
//alert(ID_insert_service_to_sale);
element = document.createElement("input");
element.setAttribute("name", "service_delete");
element.setAttribute("type", "button");
element.setAttribute("value", "Remove");
element.setAttribute("onClick", "removeThisServiceOnNewSale('"+tr_id+"','"+id+"',' "+ID_insert_service_to_sale+"','"+price_after_disc ount_String+"','"+insert_customer_on_service+"')") ;
td1.appendChild(element);
row.appendChild(td1);
}
else if(array_value.startsWith('Extra Info'))
{
element = document.createElement("a");
element.setAttribute('onmouseover','tooltip.on("'+ array_value +'")');
element.setAttribute('onmouseout','tooltip.off()') ;
element.setAttribute('onmousemove','tooltip.move(e vent)');
var linkText=document.createTextNode('Extra Info');
element.appendChild(linkText);
td1.appendChild(element);
row.appendChild(td1);
}
else
{
td1.appendChild(document.createTextNode(array_valu e));
row.appendChild(td1);
}
}
tbody.appendChild(row);
parent.Windows.focusedWindow.destroy();
}



gracias