Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/10/2012, 15:20
kef_11
 
Fecha de Ingreso: junio-2012
Mensajes: 30
Antigüedad: 11 años, 10 meses
Puntos: 1
Pregunta Respuesta: Hacer que una pagina realice el submit de un formulario que esta en otra p

Disculpa no crei que fuera importante, no lo puse porque si me esta funcionando.

Código:
/*
* Parametros mandatorios
*/
    var seconds = 10; // el tiempo en que se refresca
	var divid = "cerrado"; // el div que quieres actualizar!
	var url = "cerrarexamen.php"; // el archivo que ira en el div

	function refreshdiv(){

		// The XMLHttpRequest object

		var xmlHttp;
		try{
			xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
			}
			catch (e){
				try{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e){
					alert("Tu explorador no soporta AJAX.");
					return false;
				}
			}
		}

		// Timestamp for preventing IE caching the GET request
		var timestamp = parseInt(new Date().getTime().toString().substring(0, 10));
		var nocacheurl = url+"?t="+timestamp;

		// The code...

		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState== 4 && xmlHttp.readyState != null){
				document.getElementById(divid).innerHTML=xmlHttp.responseText;
				setTimeout('refreshdiv()',seconds*1000);
			}
		}
		xmlHttp.open("GET",nocacheurl,true);
		xmlHttp.send(null);
	}

	// Empieza la función de refrescar

	window.onload = function(){
		refreshdiv(); // corremos inmediatamente la funcion
	}
Lo que ocupo es que el primer archivo, ejecute el submit del segundo