Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <select name="vyber" id="vyber" onchange="vyberClanek();">
- <option value="0">Vyberte článek</option>
- <option value="test2">Článek jedna</option>
- <option value="test3.html">Článek dvě</option>
- </select>
- <div id="mistoZobrazeni">
- </div>
- <script>
- function vyberClanek()
- {
- var url = document.getElementById("vyber").value;
- if (url != 0)
- {
- if (window.ActiveXObject)
- {
- httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
- }
- else
- {
- httpRequest = new XMLHttpRequest();
- }
- httpRequest.open("GET", url, true);
- httpRequest.onreadystatechange= function () {processRequest(); } ;
- httpRequest.send(null);
- }
- else
- {
- document.getElementById("mistoZobrazeni").innerHTML = "";
- }
- }
- </script>
- <script>
- function processRequest()
- {
- if (httpRequest.readyState == 4)
- {
- if(httpRequest.status == 200)
- {
- var mistoZobrazeni = document.getElementById("mistoZobrazeni");
- mistoZobrazeni.innerHTML = httpRequest.responseText;
- }
- else
- {
- alert("Chyba pri nacitani stanky
- "+ httpRequest.status +":"+ httpRequest.statusText);
- }
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement