1582nu

func

Mar 26th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. function ajax(var func){
  3.     var xmlhttp;
  4.     if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari   
  5.         xmlhttp=new XMLHttpRequest();
  6.     }
  7.     else{ // code for IE6, IE5
  8.         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  9.     }
  10.     xmlhttp.onreadystatechange=function(){
  11.         if (xmlhttp.readyState==4 && xmlhttp.status==200){
  12.             document.getElementById("calendar").innerHTML=xmlhttp.responseText;
  13.         }
  14.     }
  15.     if(func=='p'){
  16.         var pyear = document.getElementById("pyear").innerHTML;
  17.         var pmonth = document.getElementById("pmonth").innerHTML;
  18.         xmlhttp.open("GET","calendar.php?y=" + pyear + "&m=" + pmonth,true);
  19.     }else if(func=='n'){
  20.         var nyear = document.getElementById("nyear").innerHTML;
  21.         var nmonth = document.getElementById("nmonth").innerHTML;
  22.         xmlhttp.open("GET","calendar.php?y=" + nyear + "&m=" + nmonth,true);
  23.     }
  24.     xmlhttp.send();
  25. }
  26.  
  27. </script>
Advertisement
Add Comment
Please, Sign In to add comment