Código Javascript:
Ver original
function agregar(idTable,cbo){ var out="&"; var add="option"; temp= "" + cbo; while(temp.indexOf(out)>-1){ pos= temp.indexOf(out); temp= "" + (temp.substring(0,pos) + add + temp.substring((pos + out.length),temp.length)); } var oute="$"; var adde="value"; tempo= "" + temp; while(tempo.indexOf(oute)>-1){ pose= tempo.indexOf(oute); tempo= "" + (tempo.substring(0,pose) + adde + tempo.substring((pose + oute.length),tempo.length)); } var tab = document.getElementById(idTable); if(tab){ var tr = document.createElement('tr'); var td = document.createElement('td'); var td2 = document.createElement('td'); var td3 = document.createElement('td'); var td4 = document.createElement('td'); var td5 = document.createElement('td'); var td6 = document.createElement('td'); var td7 = document.createElement('td'); var td8 = document.createElement('td'); var imp = "<input type='text' id='txtcolor' name='txtcolor[]'>"; var imp2 = "<select style='font-size: 10px;' onchange='verPres(this)'><option value=''>Seleccione</option>"+tempo+"</select>"; var imp3 = "<input type='text' id='txtpaq'>"; var imp4 = "<input type='text' id='txtpiepaq'>"; var imp5 = "<input type='text' id='txttotpie'>"; var imp6 = "<input type='text' id='txtpresu'>"; var imp7 = "<input type='text' id='txttot'>"; var img = "<img src='../images/nuevo32x.png' style='cursor:pointer;' onclick='agregar('tbProd');'/>"; //c.innerHTML = htmlContent; td.innerHTML = imp; td2.innerHTML = imp2; td3.innerHTML = imp3; td4.innerHTML = imp4; td5.innerHTML = imp5; td6.innerHTML = imp6; td7.innerHTML = imp7; td8.innerHTML = img; tr.appendChild(td); tr.appendChild(td2); tr.appendChild(td3); tr.appendChild(td4); tr.appendChild(td5); tr.appendChild(td6); tr.appendChild(td7); tr.appendChild(td8); tab.appendChild(tr); } return true; }
Gracias.