Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/10/2006, 20:48
zsamer
 
Fecha de Ingreso: noviembre-2003
Mensajes: 798
Antigüedad: 20 años, 5 meses
Puntos: 8
No funciona en Internet Explorer

Hola el siguiente codigo funciona perfecto en Mozilla Firefox, pero
en internet explorer no funciona parte de la aplicacion.

El script crea elementos table, input, etc dinamicamente, y ademas hace la suma en los campos input Bruto y Retencion y el resultado lo deja en el campo liquido (calculo el cual no funciona en IE).

Código PHP:
<html>
<
head>
<
STYLE>
#testlayer {
      
positionabsolute;
   
background#732264;
   
color#ffffff;
   
font16px arial,helvetica;
   
top: -120px/* hide it on load */
   
z-index3;
}

</
STYLE>
   <
script type="text/javascript">
    var 
rowNumber 1;
    function 
delRow(buttonTable)
    {
      var 
row button.parentNode.parentNode;
      var 
tbody document.getElementById(Table).getElementsByTagName('tbody')[0];
      
tbody.removeChild(row);
    }

/**************************************************************/
function Suma(CantidadBrutoRetencionLiquidoLiquidosimporte)
{
    var 
Valor1 parseInt(document.getElementById(Cantidad).value);
    var 
Valor2 parseInt(document.getElementById(Liquido).value);
    var 
Valor3 0.9;
    
    
document.getElementById(Liquidosimporte).value parseInt((Valor1*Valor2));
    
document.getElementById(Bruto).value parseInt(((Valor1*Valor2)/Valor3));
    
document.getElementById(Retencion).value = (parseInt(((Valor1*Valor2)/Valor3))-(Valor1*Valor2));
}

    function 
addRow(Table)
    {  

      var 
aTable document.getElementById(Table)
      
aTable.setAttribute("name",Table);
      
aTable.setAttribute("border",0);
      var 
tbody document.getElementById(Table).getElementsByTagName('tbody')[0];
      
tbody.setAttribute('name','TableBody');

      var 
row document.createElement('TR');
      var 
cells = Array();
      var 
inp = Array();
      
      for (
1i<9i++){
         
cells[i] =  document.createElement('td');
         
inp[i] = document.createElement('input');

      }
      
cells[2].setAttribute('width','10px');

      
inp[1] = document.createTextNode(rowNumber);

      
inp[2].setAttribute('type','text');
      
inp[2].setAttribute('name','cantidad['+rowNumber+']');
      
inp[2].setAttribute('id','cantidad['+rowNumber+']');
      
inp[2].setAttribute('size','4');
      
inp[2].setAttribute('maxlength','4');
      
inp[2].setAttribute('value','1');
      
inp[2].setAttribute("onKeyUp","Suma('cantidad["+rowNumber+"]', 'bruto["+rowNumber+"]', 'retencion["+rowNumber+"]', 'liquido["+rowNumber+"]', 'liquidosimporte["+rowNumber+"]')");
      
inp[2].setAttribute('autocomplete','OFF');
      
      
inp[3].setAttribute('type','text');
      
inp[3].setAttribute('name','item['+rowNumber+']');
      
inp[3].setAttribute('id','item['+rowNumber+']');
      
inp[3].setAttribute('size','20');
      
inp[3].setAttribute('maxlength','20');
      
inp[3].setAttribute('value','');
      
inp[3].setAttribute('autocomplete','OFF');      

      
inp[4].setAttribute('type','text');
      
inp[4].setAttribute('name','liquido['+rowNumber+']');
      
inp[4].setAttribute('id','liquido['+rowNumber+']');
      
inp[4].setAttribute('size','10');
      
inp[4].setAttribute('maxlength','20');
      
inp[4].setAttribute('value','0');
      
inp[4].setAttribute("onKeyUp","Suma('cantidad["+rowNumber+"]', 'bruto["+rowNumber+"]', 'retencion["+rowNumber+"]', 'liquido["+rowNumber+"]', 'liquidosimporte["+rowNumber+"]')");
      
inp[4].setAttribute('autocomplete','OFF');
      
      
inp[5].setAttribute('type','text');
      
inp[5].setAttribute('name','liquidosimporte['+rowNumber+']');
      
inp[5].setAttribute('id','liquidosimporte['+rowNumber+']');
      
inp[5].setAttribute('size','10');
      
inp[5].setAttribute('maxlength','20');
      
inp[5].setAttribute('value','');
      
inp[5].setAttribute('autocomplete','OFF');
      
      
inp[6].setAttribute('type','text');
      
inp[6].setAttribute('name','retencion['+rowNumber+']');
      
inp[6].setAttribute('id','retencion['+rowNumber+']');
      
inp[6].setAttribute('size','10');
      
inp[6].setAttribute('maxlength','20');
      
inp[6].setAttribute('value','');
      
//inp[6].setAttribute('disabled','true');
      
inp[6].setAttribute('autocomplete','OFF');

      
inp[7].setAttribute('type','text');
      
inp[7].setAttribute('name','bruto['+rowNumber+']');
      
inp[7].setAttribute('id','bruto['+rowNumber+']');
      
inp[7].setAttribute('size','10');
      
inp[7].setAttribute('maxlength','20');
      
inp[7].setAttribute('value','');
      
//inp[7].setAttribute('disabled','true');
      
inp[7].setAttribute('autocomplete','OFF');
      
      
// remove and Add row buttons
      
inp[8].setAttribute('type','image');
      
inp[8].setAttribute('name','RemoveRow.' rowNumber '.13');
      
inp[8].setAttribute('src','minus.jpg');
      
inp[8].onclick=function(){delRow(thisTable);}

      for (
1i<9i++){
        
cells[i].appendChild(inp[i]);
        
row.appendChild(cells[i]);
      }
      
rowNumber++;
      
tbody.appendChild(row);
    }

  
</script>
</head>
<body>

<form name=Form1 action="index.php" method="post">

<table border="0" id="table1" name="table1">
<input type="button" value="Add Row to table 1" onClick="addRow('table1');">
  <tr>
    <td><b>Número Linea</b></td>
    <td><b>Cantidad</b></td>
    <td><b>Item</b></td>
    <td><b>Liquido</b></td>
    <td><b>Liquido Importe</b></td>
    <td><b>Retención</b></td>
    <td><b>Bruto</b></td>
  </tr>
</table>

<input type="submit" value="Add" name="add" >
</form>
</body>
</html> 
gracias y salu2