Ver Mensaje Individual
  #22 (permalink)  
Antiguo 16/01/2007, 21:51
Avatar de BLAH !!
BLAH !!
 
Fecha de Ingreso: septiembre-2003
Ubicación: Región Metropolitana, Santiago, Chile
Mensajes: 706
Antigüedad: 20 años, 7 meses
Puntos: 16
De acuerdo Re: llamar valor de un input text y dejarlo en mi codigo php (en la misma pagina)

POR FIN ENCONTRE EL ERROR AHORA FUNCIONA... !!!
MIRA AHI VA EL CODIGO (CAMBIE LA CREACION DEL OBJETO PERO ESO NO ERA)


default.html
Código PHP:
<html>
<
head>
<
script language="javascript" type="text/javascript">
//Con esta función creo el nuevo objeto AJAX
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(
errl) {
  try {
  
req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (
err2) {
    try {
    
req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (
err3) {
      
req false;
    }
  }
}
return 
req;
}
  
//Este es el método que ocupo yo para crear un objeto AJAX (más arriba). Puedes
//usar el método que quieras, o una de las librerias que hay en este foro.
var oXML getXMLHTTPRequest();

//Establece el controlador de AJAX
function procesar(valortexto){
    var 
valor document.formulario.valor.value;
    var 
url "numberswords.php?numero=" valor;
    
oXML.open("GET"urltrue);
    
oXML.onreadystatechange respuestaAjax;
    
oXML.send(null);
}


function 
respuestaAjax() {
if (
oXML.readyState == 4) {
 if (
oXML.status == 200) {
   
document.formulario.texto.value oXML.responseText;
   }
 }
}
</script>
</head>
<body>
    <form name="formulario">
        <input type="text" name="valor">
        <input type="text" name="texto">
        <input type="button" onclick="procesar('valor', 'texto')" value="calcular">
    </form>
</body>
</html> 


numberswords.php
Código PHP:
<?php  
header
('Content-Type: text/xml'); 
    require_once 
'Numbers/Words.php';  
    
$nw = new Numbers_Words();  
    
$resultadio $nw->toWords($_GET['numero']); 
    echo 
"$resultadio";
?>
__________________
Adios ...!!!!