Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/06/2010, 18:28
Avatar de ronnyra
ronnyra
 
Fecha de Ingreso: diciembre-2009
Mensajes: 173
Antigüedad: 15 años, 3 meses
Puntos: 1
Respuesta: problema con un botón

este es uno...

Código Javascript:
Ver original
  1. function ValidarParticipante()
  2. {
  3.     // variables que se envian
  4.     var Cod_Inscrip_Est=document.getElementById('Cod_Inscrip_Est');    
  5.     var nombre_com=document.getElementById('nombre_com');
  6.     var Cod_Est=document.getElementById('Cod_Est');
  7.     var Semestre=document.getElementById('Semestre');
  8.     var Nom_Programa=document.getElementById('Nom_Programa');
  9.    
  10.     if(Cod_Inscrip_Est.value == "")
  11.     {
  12.         alert("El Campo Codigo de inscripcion Está Vacío");
  13.         Cod_Inscrip_Est.focus();
  14.         return false;
  15.     }
  16.     if(nombre_com.value == "")
  17.     {
  18.         alert("El Campo nombre Está Vacío");
  19.         nombre_com.focus();
  20.         return false;
  21.     }
  22.     if(Cod_Est.value == "")
  23.     {
  24.         alert("El Campo codigo del estudiante Está Vacío");
  25.         Cod_Est.focus();
  26.         return false;
  27.     }
  28.     if(Semestre.value == "")
  29.     {
  30.         alert("El Campo semestre Está Vacío");
  31.         Semestre.focus();
  32.         return false;
  33.     }
  34.     if(Nom_Programa.value == "")
  35.     {
  36.         alert("El Campo Programa Está Vacío");
  37.         Nom_Programa.focus();
  38.         return false;
  39.     }
  40.     return true;
  41. }
este es el otro que es un ajax
Código Javascript:
Ver original
  1. function nuevoAjax1()
  2. {
  3.     /* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
  4.     lo que se puede copiar tal como esta aqui */
  5.     var xmlhttp=false;
  6.     try
  7.     {
  8.         // Creacion del objeto AJAX para navegadores no IE
  9.         xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  10.     }
  11.     catch(e)
  12.     {
  13.         try
  14.         {
  15.             // Creacion del objet AJAX para IE
  16.             xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  17.         }
  18.         catch(E)
  19.         {
  20.             if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
  21.         }
  22.     }
  23.     return xmlhttp;
  24. }
  25.  
  26.  
  27.    
  28. function AgregarParticipante(idSelectOrigen)
  29. {
  30.     // div donde carga el contenido
  31.     var contenido=document.getElementById(idSelectOrigen);
  32.    
  33.     var Cod_Inscrip_Est=document.getElementById('Cod_Inscrip_Est').value;      
  34.     var nombre_com=document.getElementById('nombre_com').value;
  35.     var Cod_Est=document.getElementById('Cod_Est').value;
  36.     var Semestre=document.getElementById('Semestre').value;
  37.     var Nom_Programa=document.getElementById('Nom_Programa').value;
  38.    
  39.  
  40.     // Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
  41.     var ajax=nuevoAjax1();
  42.     ajax.open("GET", "ajax_inscrip/tabla_participantes.php?accion=0&Cod_Inscrip_Est="+Cod_Inscrip_Est+"&nombre_com="+nombre_com+"&Cod_Est="+Cod_Est+"&Semestre="+Semestre+"&Nom_Programa="+Nom_Programa, true);
  43.    
  44.     ajax.onreadystatechange=function()
  45.     {
  46.         if (ajax.readyState==1)
  47.         {
  48.             contenido.innerHTML="Cargando...";                 
  49.         }
  50.         if (ajax.readyState==4)
  51.         {
  52.             contenido.innerHTML=ajax.responseText;
  53.         }
  54.     }
  55.     ajax.send(null);   
  56. }