<html>
    <head>
        <script>
            function prikazi(str) {
                if (str.lenght == 0) {
                    document.getElementById("txtIspis").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    objekat = new XMLHttpRequest();
                } else {
                    objekat = new ActiveXObject("Microsoft.XMLHTTP");
                }
                objekat.onreadystatechange = function() {
                    if (objekat.readyState == 4 && objekat.status == 200) {
                        document.getElementById("txtIspis").innerHTML =
                                objekat.responseText;
                    }
                }
                objekat.open("GET", "ispis.php?ime=" + str, true);
                objekat.send();
            }
        </script>
    </head>
    <body>
        <h3>Upisite ime:</h3>
        <form name="forma" action="">
            Ime: <input type="text" size="20" id="txt1" 
                        onkeyup="prikazi(this.value)">
        </form>
        <p>Pronadjena imena su:
            <span id="txtIspis"> </span>
        </p>
    </body>
</html>
