Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2009, 10:59
robertocorona
 
Fecha de Ingreso: febrero-2006
Mensajes: 155
Antigüedad: 18 años, 3 meses
Puntos: 0
Respuesta: Textbox con Descripción

Código de ejemplo, muy sencillo pero es lo que pude lograr hasta ahora.
Gracias, Saludos

Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sin título 1</title>

<script type="text/javascript">

function ltrim(s) {return s.replace(/^\s+/, "");}
function rtrim(s) {return s.replace(/\s+$/, "");}
function Trim(sCadena) {return rtrim(ltrim(sCadena));}

function Salida(txt){
if (Trim(txt.value) == '') {
txt.value = txt.title;
txt.style.color= '#b2b2b2';
}
}

function Entrada(txt){
if (txt.value == txt.title) {
txt.value = '';
txt.style.color= '#000000';
}
}

</script>

</head>

<body>
<input name="Text1" type="text" onblur="Salida(this)" onfocus="Entrada(this)" title="Escribir" />
</body>

</html>