Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2. pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  7. <title>Insert title here</title>
  8. <script type="text/javascript">
  9. function display(str){
  10. var xhr;
  11. var div1 = document.getElementById("div1");
  12. if (window.XMLHttpRequest) { // Mozilla, Safari, ...
  13. xhr = new XMLHttpRequest();
  14. } else if (window.ActiveXObject) { // IE 8 and older
  15. xhr = new ActiveXObject("Microsoft.XMLHTTP");
  16. }
  17. xhr.onreadystatechange = function(){
  18. if(xhr.readyState==4 && xhr.status==200){
  19. div1.innerHTML = "";
  20. var res = xhr.responseText;
  21. var wrds = res.split("-");
  22. for(var i = 0 ;i<wrds.length;i++){
  23. div1.innerHTML += wrds[i]+"<br />";
  24. }
  25. }
  26. };
  27. xhr.open("GET","AutoServer2.jsp?cname="+str);
  28. xhr.send();
  29. }
  30. </script>
  31. </head>
  32. <body>
  33. <form>
  34. <input type="text" id="ctry" onkeyup="display(this.value)" />
  35. <div id="div1"
  36. style="height: 150px; width: 100px; background-color: #e3e3e3">
  37. </div>
  38. </form>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement