Advertisement
Guest User

Untitled

a guest
Aug 11th, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.19 KB | None | 0 0
  1. <select name="vyber" id="vyber" onchange="vyberClanek();">
  2.    <option value="0">Vyberte článek</option>
  3.    <option value="test2">Článek jedna</option>
  4.    <option value="test3.html">Článek dvě</option>
  5. </select>
  6.  
  7. <div id="mistoZobrazeni">
  8. </div>
  9.  
  10.  
  11. <script>
  12. function vyberClanek()
  13. {
  14.      var url = document.getElementById("vyber").value;
  15.  
  16.      if (url != 0)
  17.      {
  18.         if (window.ActiveXObject)
  19.         {
  20.           httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  21.         }
  22.         else
  23.         {
  24.           httpRequest = new XMLHttpRequest();
  25.         }
  26.         httpRequest.open("GET", url, true);
  27.         httpRequest.onreadystatechange= function () {processRequest(); } ;
  28.         httpRequest.send(null);
  29.       }
  30.       else
  31.       {
  32.  
  33.         document.getElementById("mistoZobrazeni").innerHTML = "";
  34.        
  35.       }
  36. }
  37. </script>
  38. <script>
  39. function processRequest()
  40. {
  41.   if (httpRequest.readyState == 4)
  42.   {
  43.     if(httpRequest.status == 200)
  44.     {
  45.       var mistoZobrazeni = document.getElementById("mistoZobrazeni");
  46.       mistoZobrazeni.innerHTML = httpRequest.responseText;
  47.     }
  48.     else
  49.     {
  50.         alert("Chyba pri nacitani stanky
  51. "+ httpRequest.status +":"+ httpRequest.statusText);
  52.     }
  53.   }
  54. }
  55. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement