Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Rellenar formulario y enviarlo

Estas en el tema de Rellenar formulario y enviarlo en el foro de Frameworks JS en Foros del Web. Hola, no tengo mucha idea sobre ajax, pero mirando por la red, me ha parecido interesante. He empezado a jugar un poco y ahora estoy ...
  #1 (permalink)  
Antiguo 19/07/2007, 08:35
 
Fecha de Ingreso: julio-2007
Mensajes: 3
Antigüedad: 16 años, 9 meses
Puntos: 0
Rellenar formulario y enviarlo

Hola, no tengo mucha idea sobre ajax, pero mirando por la red, me ha parecido interesante. He empezado a jugar un poco y ahora estoy un poco atrapado en un problema que no encuentro solucion. Se que para la mayoria es muy facil, pero yo de momento no llego.

Os paso mi pagina CARGA.htm
Asi consigo "alertar" toda la pagina, pero... ¿y si solo quiero "alertar" los campos que rellene del formulario? ¿y si quiero pintar los datos del formulario en un div bajo este?

Código HTML:
<!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=iso-8859-1">
<title>GET-POST</title>
<script language="JavaScript" type="text/javascript">
//AJAX///////////////////////////////////////////////////////////////////////////////////////////
//Objeto XMLHttpRequest  
function objetoXMLHttpRequest(){ 
	//Obtener la instancia del objeto 
	var obj;  
	if(window.XMLHttpRequest) { // Si no es IE  
	obj = new XMLHttpRequest();  
	} else { // Si es IE o no tiene el objeto  
	try {  
	obj = new ActiveXObject("Microsoft.XMLHTTP");  
	}  
	catch (e) {  
	alert('El navegador utilizado no está soportado');  
	}  
	}  
	return obj; 
}
/////////////////////////////////////////////////////////////////////////////////////////////////

//CARGAR PAGINA//////////////////////////////////////////////////////////////////////////////////
//Recoge datos y los envia
function cargarContenido(){
	ajax=objetoXMLHttpRequest();
	ajax.open("GET", "CARGA.htm",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		alert(ajax.responseText)
		}
	}
	ajax.send(null)
}
/////////////////////////////////////////////////////////////////////////////////////////////////
</script>
</head>

<body>
<form id="form1" name="form1" onsubmit="cargarContenido()">
<table align="CENTER" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>TEXTO 01 
      <input name="t001" type="text" id="t001"></td>
  </tr>
  <tr>
    <td>TEXTO 02 
      <input name="t002" type="text" id="t002"></td>
  </tr>
  <tr>
    <td>TEXTO 03 
      <input name="t003" type="text" id="t003"></td>
  </tr>
  <tr>
    <td>TEXTO 04 
      <input name="t004" type="text" id="t004"></td>
  </tr>
  <tr>
    <td>TEXTO 05 
      <input name="t005" type="text" id="t005"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<div align="CENTER"><input name="enviar" type="submit" value="Enviar" id="enviar" /></div>
</form>
<div id="caja">ENVIAR:</div>
</body>
</html> 
Si alguien puede ayudar a este principiante, le estaria muy agradecido.

Gracias
---------------------------------------------------------------+++---------------------
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:21.