Retroceder   Foros del Web > Programación para sitios web > AJAX

Respuesta
 
Herramientas Desplegado
Antiguo 18-nov-2006, 14:32   #1 (permalink)
jesusito ha deshabilitado el karma
 
Fecha de Ingreso: junio-2004
Mensajes: 170
Pregunta Tengo el siguiente problema

Hola quisiera saber que esta malo del siguiente codigo:

valida.html

<SCRIPT language=javascript>
function createRequestObject(){
var peticion;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){

peticion = new ActiveXObject("Microsoft.XMLHTTP");
}else{
peticion = new XMLHttpRequest();
}
return peticion;
}


var http = new Array();
function ObtDatos(url){
var act = new Date();
http[act] = createRequestObject();
http[act].open('get', url,true);
http[act].onreadystatechange = function() {
if (http[act].readyState == 4) {
if (http[act].status == 200) {
var texto

texto = http[act].responseText
var DivDestino = document.getElementById("DivDestino");
DivDestino.innerHTML = "<div id='error'>"+texto+"</div>";

}
}alert("internet explorer");
}
http[act].send(null);
}

function compUsuario(Tecla) {
Tecla = (Tecla) ? Tecla: window.event;
input = (Tecla.target) ? Tecla.target :
Tecla.srcElement;
if (Tecla.type == "keyup") {
var DivDestino = document.getElementById("DivDestino");
DivDestino.innerHTML = "<div></div>";
if (input.value) {
ObtDatos("login.php?q=" + input.value);
}
}
}
</SCRIPT>
<STYLE type=text/css>#error {
BORDER-RIGHT: #cc3333 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cc3333 1px solid; MARGIN-TOP: 10px; PADDING-LEFT: 35px; PADDING-BOTTOM: 5px; FONT: 10px Verdana, Arial, Helvetica, sans-serif; BORDER-LEFT: #cc3333 1px solid; WIDTH: 300px; COLOR: #990033; PADDING-TOP: 5px; BORDER-BOTTOM: #cc3333 1px solid;
}
</STYLE>

<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<P>Teclea tu Id de usuario: <INPUT id=textField onkeyup=compUsuario(event)
name=IdUsuarui> </P>
<P><EM>(El usuario juan ya estaria registrado en el sistema) </EM></P>
<DIV id=DivDestino></DIV></BODY></HTML>



login.php

<?php

if ($_GET["q"] == "juan"){
echo "El ID se encuentra ocupado";
}
else {
echo "Puedes utilizarlo";
}
?>

gracias....saludos a todos
jesusito está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 04:44.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93