Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/02/2008, 06:17
donfalcone
 
Fecha de Ingreso: noviembre-2007
Mensajes: 194
Antigüedad: 16 años, 6 meses
Puntos: 2
para qué sirve esta función?

Hola a tod@s!

He encontrado un chat hecho en AJAX en esta web (www.linuxuser.at), y estoy intentando entender el script.

y está función no consigo entender qué es, qué hace y para qué sirve,... sólo se que cuando la quito,... se rompe el invento....

la susodicha función es:
Código PHP:
time = new Date();
                
ms = (time.getHours() * 24 60 1000) + (time.getMinutes() * 60 1000) + (time.getSeconds() * 1000) + time.getMilliseconds(); 
y se encuentra en este contexto:
Código PHP:
/* Request for Reading the Chat Content */
function ajax_read(url) {

        if(
window.XMLHttpRequest){
                return new 
XMLHttpRequest();
        }else if(
window.ActiveXObject){
                return new 
ActiveXObject("Microsoft.XMLHTTP");
        }

        
xmlhttp.onreadystatechange = function() {
        if (
xmlhttp.readyState==4) {
                
document.getElementById("chatwindow").innerHTML xmlhttp.responseText;

                
time = new Date();
                
ms = (time.getHours() * 24 60 1000) + (time.getMinutes() * 60 1000) + (time.getSeconds() * 1000) + time.getMilliseconds();
                
intUpdate setTimeout("ajax_read('chat.txt?x=" ms "')"waittime)
                }
        }

        
xmlhttp.open('GET',url,true);
        
xmlhttp.send(null);

Gracias y saludos