Foros del Web » Programando para Internet » Javascript »

Problema con codigo javascript

Estas en el tema de Problema con codigo javascript en el foro de Javascript en Foros del Web. Hola a todos, espero puedan ayudarme con el siguiente codigo, lo que pasa es que en IE funciona muy bien, pero como migramos la aplicación ...
  #1 (permalink)  
Antiguo 16/05/2009, 17:40
 
Fecha de Ingreso: mayo-2009
Mensajes: 1
Antigüedad: 15 años
Puntos: 0
Pregunta Problema con codigo javascript

Hola a todos, espero puedan ayudarme con el siguiente codigo, lo que pasa es que en IE funciona muy bien, pero como migramos la aplicación a firefox, ya no me funciona el siguiente codigo. Ya no agrega las filas de la tabla.

function mostrar(id){

if(document.formulario.sCli.value == "-1")
{
alert("Primero debe seleccionar el cliente")
}

else
{

var q = parseInt(document.formulario.contEA.value);

<?php
$sql="SELECT id_cliente FROM clientes";
$rs= mysql_query($sql);
while ($reg=mysql_fetch_array($rs)){
$cd=$reg['id_cliente'];
echo "var producto_".$cd."=new Array(";
$sql1="SELECT DISTINCT name_producto FROM ingreso_productos WHERE id_cliente='$cd' order by name_producto asc";
$rs1= mysql_query($sql1);
$filas=mysql_num_rows($rs1);
for ($i=0;$i< $filas;$i++) {
$pro=mysql_result($rs1,$i,'name_producto');
if ($i==0)
echo "'".$pro."'";
else
echo ",'".$pro."'";
};
echo ");\n";
}
?>

var cli = formulario.sCli[document.formulario.sCli.selectedIndex].value
ver_productos=eval('producto_' + cli)
num_pro = ver_productos.length

var unidades = new Array();
unidades[q]= document.createElement("select");
unidades[q].name = "un_ip["+q+"]";

var opc = new Array();
opc[q] = document.createElement("option");

var opd = new Array();
opd[q] = document.createElement("option");

opc[q].value = "UN";
opd[q].value = "KG";
var txtc = new Array();
txtc[q] = document.createTextNode('UN');
var txtd = new Array();
txtd[q] = document.createTextNode('KG');
opc[q].appendChild(txtc[q]);
opd[q].appendChild(txtd[q]);
unidades[q].appendChild(opc[q]);
unidades[q].appendChild(opd[q]);

var inputa = new Array();
inputa = document.createElement("");
inputa[q] = "<input type='text' name='cantidad["+q+"]' size='12' onKeypress='if(!isNS4){if(event.keyCode <46 || event.keyCode >57) event.returnValue = false;}else{if(event.which <46 || event.which >57) return false;}'>"

var inputb = new Array();
inputb[q] = "<input type='text' name='lote["+q+"]' size='10' >"
var inputc = new Array();
inputc[q] = "<input type='text' name='observaciones["+q+"]' size='20'>"
var inputd = new Array();
inputd[q] = "<input type='radio' name='certa["+q+"]' value='SI'>"
var inpute = new Array();
inpute[q] = "<input type='radio' name='certa["+q+"]' value='NO'>"

var tbody = document.getElementById(id).getElementsByTagName(" TBODY")[0];
var row = document.createElement("TR")
row.id = "tr"+q;


var td1 = document.createElement("TD")
//td1.appendChild(lista1[q])

var opciones = "";
opciones += "<select name='namep["+q+"]' id='["+q+"]' onChange='gmid(this.value,this.name,this.id)'>"
opciones += "<option value='-1'>Seleccione</option>"
for(i=0;i<num_pro;i++)
{
opciones += "<option value='"+ver_productos[i]+"'>"+ver_productos[i]+"</option>"
}
opciones += "</select>";
td1.innerHTML=opciones;

var td2 = document.createElement("TD")
//td2.appendChild(lista2[q])
td2.innerHTML="<input type=text id='codigop["+q+"]' readOnly size=10 style='background-color:#F0F0F0;text-align:center;font-color:blue;'>";

var td3 = document.createElement("TD")
td3.appendChild (document.createElement(inputa[q]))

var td4 = document.createElement("TD")
td4.appendChild (document.createElement(inputb[q]))

var td5 = document.createElement("TD")
td5.appendChild (document.createElement(inputc[q]))

var td6 = document.createElement("TD")
td6.appendChild (document.createElement(inputd[q]))

var td7 = document.createElement("TD")
td7.appendChild (document.createElement(inpute[q]))

td3.appendChild(unidades[q])

row.appendChild(td2);
row.appendChild(td1);
row.appendChild(td3);
row.appendChild(td4);
row.appendChild(td5);
row.appendChild(td6);
row.appendChild(td7);
tbody.appendChild(row);

formulario.sCli.disabled = true;
q = q + 1;
nEA = q;
document.formulario.contEA.value = nEA;
if(nEA >= 2)
{
eentradas.style.visibility = "";
}
}
}

function eliminar(){

var q = parseInt(document.formulario.contEA.value);
var x=document.getElementById("tabla");
if(q <= 1)
{
eentradas.style.visibility = "hidden";
}
else
{

x.deleteRow(q+1);
q = q - 1;
nEA = q;
document.formulario.contEA.value = nEA;
if(nEA <= 1)
{
eentradas.style.visibility = "hidden";
}
}
}

function vImprimir(){

}
</script>

Agradezco su colaboración
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:15.