RSS
Recortes: 26
html
Ajax
XMLHttpRequest
imagenes
JS
css
checkbox
validar
redirecicon
cuentas_bancarias
trim
nie
eventos
cif
variable
scroll
declarada
altura
vacio
php
forma
correo
xhtml
temporizado
jquery
div
button
validaciones
radio
head
CSharp
texto
dni
cadena
validacion_fecha
redireccion
historia
tiempo
mayusculas
electronico
function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP ObjectY para poder realizar la petición mediante POST es importante la siguiente linea de enconding:
http.open("POST", url, true); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1'); http.onreadystatechange = handleHttpResponse;Siendo "handleHttpResponse" la función que queramos que trate la respuesta.
function handleHttpResponse() { if (http.readyState == 4) { results = http.responseText; //tratar la respuesta contenida en results. } }
// definiciones basicas OCULTO="none"; VISIBLE="block"; function abrecierra(nodo) { estado = document.getElementById(nodo).style.display; if (estado==OCULTO) { document.getElementById(nodo).style.display=VISIBLE; } else { document.getElementById(nodo).style.display=OCULTO; } }
function trim(s) { while (s.length>0 && (s[0]==' '||s[0]=='\n')) s=s.substring(1, s.length); while (s.length>0 && (s[s.length-1]==' '||s[s.length-1]=='\n')) s=s.substring(0, s.length-1); return s; }
function getContent(sURL) { var xmlhttp; if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", sURL, false); xmlhttp.send(null); } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); if(xmlhttp) { xmlhttp.open("GET", sURL, false); xmlhttp.send(); } } return xmlhttp.responseXML; }...
function getContent(sURL) { var xmlhttp; if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", sURL, false); xmlhttp.send(null); } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); if(xmlhttp) { xmlhttp.open("GET", sURL, false); xmlhttp.send(); } } return xmlhttp.responseText; }...
<script> // definiciones basicas OCULTO="none"; VISIBLE="block"; function mostrar(blo) { document.getElementById(blo).style.display=VISIBLE; document.getElementById('ver_off').style.display=VISIBLE; document.getElementById('ver_on').style.display=OCULTO; } function ocultar(blo) { document.getElementById(blo).style.display=OCULTO; document.getElementById('ver_off').style.display=OCULTO; document.getElementById('ver_on').style.display=VISIBLE; } </script>Y el código HTML que lo utiliza:
<div id="ver_on"><a href="#" onclick="mostrar('bloque')">Ver más</a></div> <div id="ver_off" style="display: none"><a href="#" onclick="ocultar('bloque')">Ver menos</a></div> <div id="bloque" style="display: none">Texto a mostrar u ocultar</div>