Ver Mensaje Individual
  #3  
Antiguo 13-11-2007
Avatar de papulo
papulo papulo is offline
Miembro
 
Registrado: ago 2005
Ubicación: Lleida - Cataluña - España -Europa - Planeta tierra - Sistema solar - Via Lactea ...
Posts: 542
Reputación: 22
papulo Va por buen camino
Aquí va "autocomplete"

Código PHP:
function autocomplete (thevalue, e){ 
         
        
theObject = document.getElementById("autocompletediv"); 
         
        
theObject.style.visibility = "visible"; 
        
theObject.style.width = "152px"; 
         
        var 
posx = 0; 
        var 
posy = 0; 
         
        
posx = (findPosX (document.getElementById("yourname")) + 1); 
        
posy = (findPosY (document.getElementById("yourname")) + 23); 
         
        
theObject.style.left = posx + "px"; 
        
theObject.style.top = posy + "px"; 
         
        var 
theextrachar = e.which; 
         
        if (
theextrachar == undefined){ 
            
theextrachar = e.keyCode; 
        } 
         
        
//The location we are loading the page into. 
        
var objID = "autocompletediv"; 
 
        
//Take into account the backspace. 
        
if (theextrachar == 8){ 
            if (
thevalue.length == 1){ 
                var 
serverPage = "html/index/autocomp.php"; 
            } else { 
                var 
serverPage = "html/index/autocomp.php" + "?sstring=" + thevalue.substr (0, (thevalue.length -1)); 
            } 
        } else { 
            var 
serverPage = "html/index/autocomp.php" + "?sstring=" + thevalue + String.fromCharCode (theextrachar); 
        } 
         
        var 
obj = document.getElementById(objID); 
        
xmlhttp.open("GET", serverPage); 
        
xmlhttp.onreadystatechange = function() { 
            if (
xmlhttp.readyState == 4 && xmlhttp.status == 200) { 
                
obj.innerHTML = xmlhttp.responseText; 
            } 
        } 
        
xmlhttp.send(null); 
    } 
__________________
"El aprendizaje potencia la intuición"
Yo mismo, en un momento de inspiración. v2.0
Responder Con Cita