Tutta qui la pagina.codice:<html> <head> <style type="text/css"> body{ font-family:verdana; font-size:8pt; } input.stato{ display:none; border-color:#fff; border:0px; color:#0000aa; } </style> <script type="text/javascript"> var req; var lastValue = []; function createXmlRequest(){ // ... return new XMLHttpRequest(); } function recorder(ido){ alert(ido); var valore = document.getElementById(ido).value; if(lastValue[ido]){ if(lastValue[ido] == valore){ // nothing }else{ lastValue[ido] = valore; getValue(valore, ido); } }else{ lastValue[ido] = valore; getValue(valore, ido); } } document.getElementById("uname").onblur=recorder("uname"); document.getElementById("pwd").onblur=recorder("pwd"); function takeResponse(){ if(req.status==200){ alert("c"); var res = req.responseText; document.getElementById("stato").style.display='block'; document.getElementById("stato").innerHTML=res; alert(res); //delete req; } } function getValue(valore, idobj){ if(req==null) req = createXmlRequest(); alert("il primo"); req.open("GET","elab.php?field="+idobj+"&value="+valore, true); req.send(null); req.onreadystatechange = takeResponse; alert("pre"); } </script> </head> <body> <div id="stato" class="stato"> </div> <form action="login.php" id="login"> <label for="uname">Username</label> <input type="text" name="username" id="uname" /> <label for="pwd">Password</label> <input type="password" name="passw" id="pwd" /> <input type="submit" name="sent" value="Login" id="sub" /> </form> </body> </html>
Gli alert() servono solo per determinare il "percorso" dell'applicazioncina.

Rispondi quotando