Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function showUser(str)
  5. {
  6. if (str=="")
  7. {
  8. document.getElementById("txtHint").innerHTML="";
  9. return;
  10. }
  11. if (window.XMLHttpRequest)
  12. {// code for IE7+, Firefox, Chrome, Opera, Safari
  13. xmlhttp=new XMLHttpRequest();
  14. }
  15. else
  16. {// code for IE6, IE5
  17. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  18. }
  19. xmlhttp.onreadystatechange=function()
  20. {
  21. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  22. {
  23. //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  24. alert("testing");
  25. }
  26. }
  27. xmlhttp.open("GET","querie.php");
  28. xmlhttp.send();
  29. }
  30. </script>
  31. </head>
  32. <body>
  33.  
  34. <form>
  35. <select name="users" onchange="showUser(this.value)">
  36. <option value="">Select a person:</option>
  37. <option value="1">Peter Griffin</option>
  38. <option value="2">Lois Griffin</option>
  39. <option value="3">Glenn Quagmire</option>
  40. <option value="4">Joseph Swanson</option>
  41. </select>
  42. </form>
  43. <form id="game" action="" onsubmit="return showUser(this.value)" method="post">
  44. <input type=submit value=Send />
  45.  
  46. </form>
  47. <br />
  48. <div id="txtHint"><b>Person info will be listed here.</b></div>
  49. </body>
  50. </html>
  51.  
  52. <form id="game" action="" onsubmit="return showUser(**this.value**)" method="post">
  53.  
  54. <form id="game" action="" onsubmit="return showUser(document.name_of_form1.users.options[document.name_of_form1.users.selectedIndex].value)" method="post">
  55.  
  56. <form method="post"
  57. onsubmit="var users=document.getElementById('users'); showUser(users[users.selectedIndex].value); return true;">
  58. <select id="users" name="users" onchange="showUser(this.value);">
  59. <option value="">Select a person:</option>
  60. <option value="1">Peter Griffin</option>
  61. <option value="2">Lois Griffin</option>
  62. <option value="3">Glenn Quagmire</option>
  63. <option value="4">Joseph Swanson</option>
  64. </select>
  65. <input type="submit" value="Send" />
  66. </form>
  67.  
  68. <html>
  69. <head>
  70. <script type="text/javascript">
  71. function showUser() {
  72. var xmlhttp = null;
  73. if (window.XMLHttpRequest) {
  74. // code for IE7+, Firefox, Chrome, Opera, Safari
  75. xmlhttp = new XMLHttpRequest();
  76. } else {
  77. // code for IE6, IE5
  78. xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
  79. }
  80. xmlhttp.onreadystatechange = function() {
  81. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  82. document.getElementById('txtHint').innerHTML = xmlhttp.responseText;
  83. }
  84. }
  85. xmlhttp.open('GET', 'querie.php');
  86. xmlhttp.send();
  87. }
  88. </script>
  89. </head>
  90. <body>
  91.  
  92. <form onsubmit="showUser(); return false;" method="post">
  93. <input type="submit" value="Send" />
  94. </form>
  95.  
  96. <br />
  97. <div id="txtHint"><b>Person info will be listed here.</b></div>
  98. </body>
  99. </html>
Add Comment
Please, Sign In to add comment