Guest User

Untitled

a guest
Jan 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <script type="text/javascript">
  2. function load(file,container)
  3. {
  4. var xmlhttp, newhash = '';
  5.  
  6. if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();}
  7. if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
  8.  
  9. xmlhttp.onreadystatechange= function (){
  10. if(xmlhttp.readyState==4 && xmlhttp.status==200)
  11. { document.getElementById(container).innerHTML=xmlhttp.responseText;
  12. } else {
  13. document.getElementById(container).innerHTML='<div style="padding:10px"> <p>Please upgrade your web browser to support modern technology.</p></div>';
  14. }
  15. }
  16. xmlhttp.open("GET",file,true);
  17. xmlhttp.send(null);
  18. }
  19. </script>
  20. <script type="text/javascript" src="jquery.js"></script>
  21. <ul>
  22. <li><a href="#" onclick="load('home.php','ajax');return false;">Home</a><li/>
  23. </ul>
  24. <div id="ajax">
  25.  
  26.  
  27.  
  28. </div>
  29.  
  30. <a href="#home" onclick="load('home.php','ajax');">Home</a>
  31.  
  32. <body onload="loadHash();">
  33.  
  34. <script>
  35. function loadHash() {
  36. var hash = window.location.href.split('#');
  37. if(hash.length == 2) {
  38. load(hash[1] + '.php','ajax');
  39. }
  40. }
  41. </script>
Add Comment
Please, Sign In to add comment