Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script>
  4. function showHint(str) {
  5. if (str.length == 0) {
  6. document.getElementById("txtHint").innerHTML = "";
  7. return;
  8. } else {
  9. var xmlhttp = new XMLHttpRequest();
  10. xmlhttp.onreadystatechange = function() {
  11. if (this.readyState == 4 && this.status == 200) {
  12. document.getElementById("txtHint").innerHTML = this.responseText;
  13. }
  14. };
  15. xmlhttp.open("GET", "gethint.php?q=" + str, true);
  16. xmlhttp.send();
  17. }
  18. }
  19. </script>
  20. </head>
  21. <body>
  22.  
  23. <p><b>Start typing a name in the input field below:</b></p>
  24. <form>
  25. First name: <input type="text" onkeyup="showHint(this.value)">
  26. </form>
  27. <p>Suggestions: <span id="txtHint"></span></p>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement