Ver Mensaje Individual
  #36 (permalink)  
Antiguo 11/05/2011, 13:57
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: consulta y onchage

¿Quieres que te salga el texto al lado del texbox donde tienes el número?

Código Javascript:
Ver original
  1. $(function(){  
  2.       $('#mas,#menos').click(function(){
  3.        $.ajax(
  4.        {
  5.        url: "buscar_producto.php",
  6.        dataType: 'text',
  7.        data: {num: $('input[name="cod"]').val()},
  8.        success:
  9.           function(datos){
  10.               $('#producto').html(datos);}    
  11.         });
  12.       });
  13.       });

Código HTML:
Ver original
  1. codigo<input type="button" class="cambiar" name="menos" id="menos" value="-" style="color:red;height:20px; width:20px" title="" onclick=" *document.getElementById('cod').value = parseInt(document.getElementById('cod').value) - 1">
  2. <input name="cod" type="text" id="cod" size="1" value="<?php //obtener un nuevo valor
  3. * mysql_connect("localhost", "root","root");
  4. * *mysql_select_db("COPROM");
  5. $sql = "select producto,cod from t_mat having max(cod)";
  6. $lib = mysql_query($sql);
  7. $rs_lib = mysql_fetch_assoc($lib);
  8. $ide_lib_nuevo = $rs_lib['cod'] ;
  9. $producto = *$rs_lib['producto'] ;
  10. echo $ide_lib_nuevo;?>" readonly="">
  11. <span id="producto"><?php echo $producto *?></span>
  12.  
  13. <input type="button" name="mas" class="cambiar" value="+" id="mas" style="color:red;height:20px; width:20px" onclick=" *document.getElementById('cod').value = parseInt(document.getElementById('cod').value) + 1" title="">
  14. <br>
  15. <br>
  16. *
  17. <br>