Ho un problema, sto facendo una prova, ma non funge una mazza

index.html
codice:
<html>
<head>

        <style type="text/css">
                input.stato{
                        display:none;
                }
         </style>

        <script type="text/javascript">
                function createXmlRequest(){
                        // ...
                        return new XMLHttpRequest();
                }

          
                function takeResponse(){
                        if(req.readyState==200){
                                alert("c");
                                var res = req.responseText;
                                document.getElementById("status").style.display='block';
                                document.getElementById("user").innerHTML=res;   
                        }
                        else{
                                return 0; 
                }
                
                function getValue(valore, idobj){
                        if(!req)
                                var req = createXmlRequest();

                        req.open("GET","elab.php?field="+idobj+"&value="+valore, true);
                        req.send(null);
                        req.onreadystatechange = takeResponse;
                }
        </script>

</head>
<body>


<form action="login.php">
        <input type="text" id="status" class="stato" value="" />
        <label for="uname" id="user">Username</label>
        <input type="text" name="username" id="uname" onblur="getValue(this.value, 'uname');"/>

        <label for="pwd" id="pass">Password</label>
        <input type="text" name="password" id="pwd" onblur="getValue(this.value, 'pwd');" />

        <input type="submit" name="send" value="Login" id="sub" />
</form>


</body>
</html>
elab.php
Codice PHP:
<?php
if(isset($_GET['field']) && isset($_GET['value']) ){
        
$f $_GET['field'];
        
$v $_GET['value'];

        if( 
$f=="uname"){
                if(
strlen($v)>20)
                        echo 
"Troppi caratteri";
                else if(
strlen($v)<5)
                        echo 
"Troppi pochi caratteri";
        }
        else if (
$f == "pwd"){
                if(
strlen($v)>20)
                        echo 
"Troppi caratteri";
                else if(
strlen($v)<5)
                        echo 
"Troppi pochi caratteri";
        }
}
?>
Solo che non fa nulla. Come mai? Dove sbaglio?

p.s.:
Io javascript non l'ho mai imparato bene... esiste un libro fatto bene (cerco il migliore, poichč ne ho gią provati altri ma fatti male)?