Ver Mensaje Individual
  #13 (permalink)  
Antiguo 19/11/2010, 14:57
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

El texto de ayuda aparece por defecto... que no es dinámico si es cierto, con 2 input funciona perfectamente... ya que llama justamente al id que va a modificar :D aca esta con 2 input...

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.     </head>
  7.     <body>
  8.         <input type="text" value="hola mundo" /><br />
  9.         <input id="_comment" name="txtsrc" value="texto de prueba">
  10.         <script language="javascript" type="text/javascript">
  11.  
  12.             var _comment    = document.getElementById('_comment') ;
  13.  
  14.             _comment.style.color = '#666666' ;
  15.  
  16.             _comment.onfocus = function(){         
  17.                 if(_comment.value == 'texto de prueba'){
  18.                     _comment.style.color = '#666666' ;
  19.                     _comment.value = ''
  20.                 }              
  21.             }          
  22.             _comment.onblur = function(){
  23.                 if(_comment.value == ''){
  24.                     _comment.style.color = '#666666' ;
  25.                     _comment.value = 'texto de prueba' ;
  26.                 }              
  27.             }
  28.            
  29.         </script>
  30.     </body>
  31. </html>