Pregunta

Problema enloquecedor aquí.

Cuando se carga mi página: <body onload="getClientDateTime();">

Ejecuta esta función: document.getElementById('ClientDateTime').value="hello world";

Que teóricamente debería insertar " hello world " en un campo oculto: <INPUT TYPE="hidden" name="ClientDateTime" id="ClientDateTime" value="">

Pero ella no es trabajadora.

Si cambio el campo para escribir " text " entonces funciona como debería pero no como un " oculto " ;. Por favor ayuda!

¿Fue útil?

Solución

Esto realmente funciona ya que alerta el valor correcto:

<html>
<head>
    <title>Test</title>
</head>
<body onload="document.getElementById('ClientDateTime').value='hello world'; alert(document.getElementById('ClientDateTime').value);">

<input type="hidden" name="ClientDateTime" id="ClientDateTime" value="" />

</body>
</html>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top