Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/06/2008, 10:12
Enea
 
Fecha de Ingreso: junio-2003
Mensajes: 744
Antigüedad: 20 años, 10 meses
Puntos: 0
Respuesta: onchange en select creado dinamicamente

Ahora entiendo lo que me decias caricatos... que vale, q ya puedo mandarle un valor al campo que me daba problemas y demás pero me encuentro q no puedo interactuar solicitandole datos a la bdd dependiendo de ese select... Supongo que si necesitaré ajax, pero no sé nada... moved el hilo alli a ver si alguien puede ayudarme a solucionarlo sin tener que aprenderme el lenguaje proque es algo muy puntual que necesito y estoy casi sin tiempo..
Vuelvo a adjuntar el codigo tal como lo tengo ahora:

Código:
<script type="text/javascript">
var n=0; 
function add() { 
  pepe = document.getElementById('tabla'); 
  n++; 
  fila = document.createElement('tr'); 
   
  titulo=new Array('concepto','descripcion', 'cantidad', 'precio', 'dto');
   
  for (i=0;i<5;i++) { 
  
	  celda = document.createElement('td'); 
	  fila.appendChild(celda); 
	  
	  switch (i) {
		case 0:
		   code=document.createElement("SELECT");
		   code.setAttribute("size","1");
		   code.setAttribute("name",titulo[i]+"[]");
   		   code.setAttribute("id",n);
		   <? while($row_conceptos=mysql_fetch_array($sql_conceptos)) { 
				print "optioncode=document.createElement('option');";
				print "optioncode.innerHTML='".$row_conceptos['nombre']."';";
				print "optioncode.value='".$row_conceptos['id']."';";
				print "code.appendChild(optioncode);";
		   } ?>
  		   code.onchange = function() {
		   <? 
			$sql_dto=mysql_query("SELECT dto from rel_proveedor_linea where id_proveedor='".$row_proveedores['id']."' and id_linea_albaran='" ?>document.write(this.value);<? "'",$conexion);
		    $row_dto=mysql_fetch_array($sql_dto);?>
		   <!-- ***************************************** <? print $row_dto[dto]; ?> -->
		   //document.getElementById("dto"+this.id).value="<?= $row_dto ?>";
		   }		   
		   
		   celda.appendChild(code);
		  break;
	  
	  	case 1:
	  	  	var code1 = document.createElement("INPUT"); 
			code1.setAttribute("type","text"); 
			code1.setAttribute("size","10"); 
			code1.setAttribute("name",titulo[i]+"[]"); 
			code1.setAttribute("id",titulo[i]+"[]");  
			celda.appendChild(code1); 
	  		pepe.appendChild(fila); 
			break;
		
		case 2:
	  	  	var code2 = document.createElement("INPUT"); 
			code2.setAttribute("type","text"); 
			code2.setAttribute("size","2"); 
			code2.setAttribute("name",titulo[i]+"[]"); 
			code2.setAttribute("id",titulo[i]+"[]");  
			celda.appendChild(code2); 
	  		pepe.appendChild(fila); 
			break;
		
		case 3:
	  	  	var code3 = document.createElement("INPUT"); 
			code3.setAttribute("type","text"); 
			code3.setAttribute("size","2"); 
			code3.setAttribute("name",titulo[i]+"[]"); 
			code3.setAttribute("id",titulo[i]+"[]");  
			celda.appendChild(code3); 
	  		pepe.appendChild(fila); 
			break;
			
		case 4:  		
			var code4 = document.createElement("INPUT"); 
			code4.setAttribute("type","text"); 
			code4.setAttribute("size","2"); 
			code4.setAttribute("name",titulo[i]+n); 
			code4.setAttribute("id",titulo[i]+n); 
			celda.appendChild(code4); 
	  		pepe.appendChild(fila); 
			break;
		}
	}
} 
</script>
__________________
Ibisof | Saludos desde Eivissa !!! :p