Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
tenho a seguinte funcao:
var cont = 0;function add() { cont++; var i = document.regPedido.produtos.selectedIndex; var c1 = document.regPedido.produtos.options[i].text; var c2 = document.getElementById('quantidade').value; var c3 = document.getElementById('prcUnit').innerHTML; var c4 = document.getElementById('prcTotal').innerHTML; var j = document.regPedido.locentrega.selectedIndex; var c5 = document.regPedido.locentrega.options[j].text; var e = document.getElementById('tbody'); var tr = document.createElement('tr'); var td1 = 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 img = document.createElement('img'); img.src = "Cliente/estrutura/Imagens/BTNdelete.gif"; tr.setAttribute("id",cont); var ith1 = document.createElement('INPUT'); ith1.setAttribute("type","hidden"); ith1.setAttribute("name","ith1_"+cont); ith1.setAttribute("id","ith1_"+cont); var ith2 = document.createElement('INPUT'); ith2.setAttribute("type","hidden"); ith2.setAttribute("name","ith2_"+cont); ith2.setAttribute("id","ith2_"+cont); var ith3 = document.createElement('INPUT'); ith3.setAttribute("type","hidden"); ith3.setAttribute("name","ith3_"+cont); ith3.setAttribute("id","ith3_"+cont); var ith4 = document.createElement('INPUT'); ith4.setAttribute("type","hidden"); ith4.setAttribute("name","ith4_"+cont); ith4.setAttribute("id","ith4_"+cont); var ith5 = document.createElement('INPUT'); ith5.setAttribute("type","hidden"); ith5.setAttribute("name","ith5_"+cont); ith5.setAttribute("id","ith5_"+cont); //td1.setAttribute("id","td1_"+cont); //td2.setAttribute("id","td2_"+cont); //td3.setAttribute("id","td3_"+cont); //td4.setAttribute("id","td4_"+cont); //td5.setAttribute("id","td5_"+cont); var t1 = document.createTextNode(c1); var t2 = document.createTextNode(c2); var t3 = document.createTextNode(c3); var t4 = document.createTextNode(c4); var t5 = document.createTextNode(c5); var t6 = document.createTextNode(img); e.appendChild(tr); tr.appendChild(td1); tr.appendChild(td2); tr.appendChild(td3); tr.appendChild(td4); tr.appendChild(td5); tr.appendChild(td6); tr.appendChild(ith1); tr.appendChild(ith2); tr.appendChild(ith3); tr.appendChild(ith4); tr.appendChild(ith5); td1.appendChild(t1); td2.appendChild(t2); td3.appendChild(t3); td4.appendChild(t4); td5.appendChild(t5); td6.appendChild(t6); document.getElementById('ith1_'+cont).value = c1; document.getElementById('ith2_'+cont).value = c2; document.getElementById('ith3_'+cont).value = c3; document.getElementById('ith4_'+cont).value = c4; document.getElementById('ith5_'+cont).value = c5;}
legal ela funciona direitinho, mas, o eskema para inserir a imagem naum ta dando certo, eu ja tentei de varias maneiras:
img.src = "Cliente/estrutura/Imagens/BTNdelete.gif";ouimg.src = ("Cliente/estrutura/Imagens/BTNdelete.gif");ouimg.setAttribute("src","Cliente/estrutura/Imagens/BTNdelete.gif");
mas nenhuma deu certo, eu vi muito no google o primeiro jeito, mas pra mim naum funfou!!
se alguem souber, agradeco!!
flw!
Carregando comentários...