Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/07/2006, 13:28
julioverne
 
Fecha de Ingreso: julio-2006
Mensajes: 6
Antigüedad: 18 años, 7 meses
Puntos: 0
De php a Javascript y a un input text

Saludos a tod@s

Tengo el siguiente código:

Cita:
<HTML>
<BODY>
<script language="javascript">

function gval(valor)
{
document.getElementById('hazlo').value=valor
}
</script>

<?php
$miVar = 'aqui el valor de la variable!';

echo "<script type='text/javascript'>\n".
"var \$miVar = '{$miVar}';\n".
"gval(\$miVar)".
"</script>\n";
?>

<table>
<form name="formas" action="">
<tr>
<td>
<input type="text" name="hazlo" size="20">
</td>
</tr>
</table>
</BODY>
</HTML>
Pero si lo ejecutan manda un mensaje de error porque no reconoce el objeto document.getElementById...

Lo que necesito hacer es que el contenido de la variable que envía desde php a la función, lo vacíe en el input text.

¿Alguien puede ayudarme?