<html>
<body>
<h3>Start typing a name in the input field below:</h3>
<form action="#">
First name: <input type="text" id="txt1" onkeyup="showHint(this.value)" />
</form>
<p>Suggestions: <span id="txtHint"></span></p>
<script>
function showHint(str) {
var xmlhttp;
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
}
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML =
this.responseText;
}
};
xmlhttp.open("GET.html", "gethint03d2-2.html?q="+str, true);
xmlhttp.send();
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/xml/tryit.asp?filename=try_dom_xmlhttprequest_suggest by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:23:25 GMT -->
</html>