Código :
function nuevoAjax() { var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function cargarContenido() { var autor,titulo,texto, contenedor; contenedor = document.getElementById('detalles'); //for(i=0; i<document.forms.elements.length; i++) //{ autor = document.getElementById('autor').value; titulor = document.getElementById('titulo').value; texto = document.getElementById('texto').value; //} ajax=nuevoAjax(); ajax.open("POST","foro.php",true); ajax.onreadystatechange=function() { if (ajax.readyState==4) { contenedor.innerHTML = ajax.responseText } else { detalles.innerHTML = '<img src="loading.gif" align="absmiddle" /> Cargando...'; } } ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); ajax.send("autor=" + autor + "& titulo =" + titulo + "& texto =" + texto); }
y luego el formulario, como invocaria la function???
<form action="javascript:cargarContenido()" method="post">
Esto haria que se me cargase la pagina foro.php dentro del div detalles???? a ver si alguien me puede ayudar con esto, gracias de antemano
bichomen