Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/08/2008, 14:25
art33
 
Fecha de Ingreso: agosto-2008
Mensajes: 272
Antigüedad: 15 años, 10 meses
Puntos: 4
que hago mal?

bueno de nuevo molestando, perdonen, pero que hago mal? y ale di mil vueltas y naa... a ver este archivo anda correcto, aun no esta terminado, mi problema es k no agrega otra linea, este archivo es el bueno.
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Test</title>
<
link media="screen" type="text/css" href="estilo.css" rel="stylesheet" />
<
style type="text/css">
<!--
@
import url("style.css");
-->
</
style>
<
script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script language="javascript" type="text/javascript">
var i = 0;
function calculaPrecio(a,b){
    var importe = document.getElementById('importe');
    importe.innerHTML = a * b;
    anadir();
}
function anadir() {
    i = i + 1;
    if (i <=9){
        var table = document.getElementById('lineaPedido');
        var row = table.insertRow(-1);
        var cell, text;
        for (var j=0; j<9; j++) {
            cell = row.insertCell(0);
            text = 'Fila' + row.rowIndex + ' Aux ' + i;
            //input1 = document.createElement("input");
            cell.setAttribute("id","miCol"+ j + "" + i);
            if (j==8){
                text = "";
                cell.appendChild(document.createTextNode(text));
                cell.innerHTML = "<button onclick=\"deleteRow(this)\">X"+row.rowIndex+"</button>";
                
            }else{
                cell.appendChild(document.createTextNode(text));
            }
        }
    }
}
</script>
</head>
<body>
<span class="head">L&iacute;neas de Pedidos</span>
<table id="background-image" summary="Meeting Results">
    <thead>
        <tr>
            <th align="center" scope="col">Producto</th>
            <th align="center" scope="col">UDM</th>
            <th align="center" scope="col">Descripci&oacute;n</th>
            <th align="center" scope="col">Existencia</th>

            <th align="center" scope="col">Zona</th>
            <th align="center" scope="col">Precio</th>
            <th align="center" scope="col">Cantidad</th>
            <th align="center" scope="col">Importe</th>
        </tr>
    </thead>
    <tbody id="lineaPedido">

        <tr>
            <td align="center"><input name="itemno" type="text" id="itemno" maxlength="7" onblur="muestraDatos()" /></td>
            <td>&nbsp;</td>
            <td><span id="descripcion">&nbsp;</span></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>$&nbsp;<input name="precio" type="text" id="precio" maxlength="13" /></td>
            <td align="center"><input name="cantidad" type="text" id="cantidad" maxlength="5" onblur="calculaPrecio(document.getElementById('precio').value,this.value)" /></td>

            <td><span id="importe">&nbsp;</span></td>
        </tr>
    </tbody>
</table>
</body>
</html> 
perdonen por tanto codigo.
este es el archivo k no agrega otra linea gracias!!
Código PHP:
<script language="javascript" type="text/javascript">
var 
0;
function 
calculaPrecio(a,b){
    var 
importe document.getElementById('importe');
    
importe.innerHTML b;
    
anadir();
}
function 
anadir() {
    
1;
    if (
<=9){
        var 
table document.getElementById('lineaPedido');
        var 
row table.insertRow(-1);
        var 
celltext;
        for (var 
j=0j<9j++) {
            
cell row.insertCell(0);
            
text 'Fila' row.rowIndex ' Aux ' i;
            
//input1 = document.createElement("input");
            
cell.setAttribute("id","miCol""" i);
            if (
j==8){
                
text "";
                
cell.appendChild(document.createTextNode(text));
                
cell.innerHTML "<button onclick=\"deleteRow(this)\">X"+row.rowIndex+"</button>";
                
            }else{
                
cell.appendChild(document.createTextNode(text));
            }
        }
    }
}
</script>
  <table summary="Meeting Results" width="75%" height="2%" border="0" cellpadding="0" cellspacing="1" bordercolor="#B1C3D9" align="center">
           <tr>
             <td height="18" colspan="9" align="center" background="http://www.forosdelweb.com/images/bg.JPG" bgcolor="#E0E0E0" scope="col"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">Pedidos</font></td>
    </tr>
            <tr>
              <th height="18" background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">#</span></th>
              <th height="14" background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7" style="text-align:center">PRODUCTO</span></th>
              <th background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">UDM</span></th>
              <th align="center" background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">DESCRIPCION</span></th>
              <th background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">EXISTENCIA</span></th>
              <th background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">ZONA</span></th>
              <th height="14" background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">PRECIO</span></th>
              <th height="14" background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">CANTIDAD</span></th>
              <th background="http://www.forosdelweb.com/images/bginp.jpg" bgcolor="#E0E0E0" scope="col"><span class="Estilo7">IMPORTE</span></th>
            </tr>
            <tr id="s">
              <th width="20" height="14" background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col" id="lineaPedido"><span class="Estilo4 Estilo5 Estilo6">1</span></th>
              <th width="50" height="14" background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col"><input type="text" id="Item" class="input" style="width:57px; height:14px"  onblur="RecuperaDescripcion(this.id,this.value,'Itemno','Uomcode Description','datos_articulo')" maxlength="7"/></th>
              <th background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col" width="70"><div id="datos_udm" style="font-size:14px"></div></th>
              <td  width="340" align="center" background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col"><div id="datos_articulo" class="Estilo3" style="font-size:10px; font-weight: bold"></div></td>
              <th background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col" width="100"><div id="datos_ext1" style="font-size:14px"></div></th>
              <th background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col" width="60"><div id="datos_zon1" style="font-size:14px"></div></th>
              <th width="50" height="14" background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col"><input type="text" id="precio" class="input" style="width:50px; height:14px; text-align:center" maxlength="15"/>              </th>
              <th width="50" height="14" background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col"><input type="text" id="cantidad" class="input" style="width:50px; height:14px; text-align:center" onblur="calculaPrecio(document.getElementById('precio').value,this.value)" maxlength="7"/></th>
              <th background="http://www.forosdelweb.com/images/bodyarea-bg.gif" bgcolor="#E0E0E0" scope="col" width="57"><span id="importe">&nbsp;</span></th>
            </tr>
  </table> 
NO SE si mi error es de javascript, lo mas seguro es k si, sino muevanlo, y si es para insultarme, ni contestes, ya sabes kien.

Última edición por art33; 19/08/2008 a las 14:28 Razón: torpeza.