function ajax(x,t) { var xmlhttp = newxmlhttp(); xmlhttp.open("GET",'ajax.php'+x+'&PHPSESSID=nr9e3l6k8fpjnngqbg0kl9qt5o',true); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var e = document.getElementById('tartalom'); e.innerHTML = this.responseText; frissit(x,t); } } xmlhttp.send(null); } function frissit(x,t) { setTimeout(function(){ajax(x,t);},t*1000); } function newxmlhttp() { if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); else if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); return xmlhttp; }