Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/01/2013, 18:16
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: evento onfocus

Entonces pasás los 2 valores como parámetro, el id del elemento y su valor

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. function fnc(elemento,elValor){
  10. var valor = document.getElementById(elemento);
  11. if(valor.value == elValor){
  12. valor.value = "";
  13. }
  14. }
  15.  
  16. //]]>
  17. </head>
  18. <form action="#">
  19. <input type="text" value="hola" id="nombre" onfocus="fnc(this.id,'hola')" /><br />
  20. <input type="text" value="hola2" id="nombre2" onfocus="fnc(this.id,'hola2')" /><br />
  21. </form>
  22. </body>
  23. </html>

Me suena a que querés hacer una suerte de "placeholder" pero no estoy muy seguro
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.