Ver Mensaje Individual
  #11 (permalink)  
Antiguo 19/11/2010, 14:26
Avatar de BloodShadow
BloodShadow
 
Fecha de Ingreso: marzo-2010
Ubicación: El Salvador
Mensajes: 393
Antigüedad: 14 años, 1 mes
Puntos: 52
Respuesta: texto de ayuda en un textarea

emprear copia y pega:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  2.     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.     <head>     
  5.         <title></title>
  6.         <link rel="stylesheet" type="text/css" href="styles.css" />
  7.     </head>
  8.     <body>
  9.         <textarea id="_comment" name="txtsrc" cols="30" rows="10">Deja tu comentario</textarea>
  10.  
  11.         <script language="javascript" type="text/javascript">
  12.  
  13.             var _comment    = document.getElementById('_comment') ;
  14.  
  15.             _comment.style.color = '#666666' ;
  16.  
  17.             _comment.onfocus = function(){         
  18.                 if(_comment.value == 'Deja tu comentario'){
  19.                     _comment.style.color = '#666666' ;
  20.                     _comment.value = ''
  21.                 }              
  22.             }          
  23.             _comment.onblur = function(){
  24.                 if(_comment.value == ''){
  25.                     _comment.style.color = '#666666' ;
  26.                     _comment.value = 'Deja tu comentario' ;
  27.                 }              
  28.             }
  29.         </script>
  30.     </body>
  31. </html>

Sinceramente no se por que si lo pones en el head no funciona... lo hice hace mucho tiempo y siempre lo he usado debajo del input a vaciar... nunca avía pensado hacer una función general para solo mandarle los id de los respectivos campos a vaciar... La are y cuando la tengo lista, la posteo de nuevo :D