Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/11/2015, 15:06
Avatar de gonzaherrera77
gonzaherrera77
 
Fecha de Ingreso: noviembre-2015
Mensajes: 60
Antigüedad: 8 años, 6 meses
Puntos: 7
Respuesta: onFocus en una imagen para mostra u ocultar un text tipo password

Para orientarte un poco, solo pude esconder la caja y no el contenido de adentro.

Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3.    <head>
  4.       <title>titulo de la pagina</title>
  5.       <meta charset="utf-8">
  6.       <script>
  7.          function mostrar() {
  8.             document.getElementById('user').setAttribute("style", "visibility: visibility;");
  9.          }
  10.          function ocultar() {
  11.             document.getElementById('user').setAttribute("style", "visibility: hidden;");
  12.          }
  13.       </script>
  14.    </head>
  15.    <body>
  16.       <form action="#" method="get">
  17.          <table align="center">
  18.             <tr>
  19.                <th colspan="2">Formulario</th>
  20.             </tr>
  21.             <tr>
  22.                <td>Usuario:</td>
  23.                <td><input type="text" id="user" /></td>
  24.             </tr>
  25.                <td>Contraseña:</td>
  26.                <td><input type="password" name="password" /></td>
  27.             </tr>
  28.                <td colspan="2" align="center"><input type="button" value="Mostrar" onClick="mostrar();"/>
  29.                <input type="button" value="Ocultar" onClick="ocultar();"/></td>
  30.             </tr>
  31.          </table>
  32.       </form>
  33.    </body>
  34. </html>

¡Saludos!