input с текстом

Советы, заготовки. Верстка. HTML, CSS, JavaScript.
Ответить
Аватара пользователя
Александр
Создатель сайта
Создатель сайта
Сообщения: 4574
Зарегистрирован: 27 сен 2009, 16:45

input с текстом

Сообщение Александр »

input с текстом

Код: Выделить всё

<input type="text" name="mail" id="mail" value="Ваш e-mail" onfocus="if(this.value=='Ваш e-mail')this.value='';" onblur="if(this.value=='')this.value='Ваш e-mail';" >


Для логина и пароля + смена цвета текста

Код: Выделить всё

<input type="text" class="tf" value="Логин" onfocus="if(this.value=='Логин'){this.value=''; this.style.color = '#000';}" onblur="if(this.value==''){this.value='Логин';  this.style.color = '#8b8b8d';}" /><br /><input type="text" class="tf" value="Пароль" onfocus="if(this.value=='Пароль') {this.value=''; this.type='password'; this.style.color = '#000';}" onblur="if(this.value=='') {this.value='Пароль'; this.type='text'; this.style.color = '#8b8b8d';}"/><br />
Ответить