This site is developed to XHTML and CSS2 W3C standards.
If you see this paragraph, your browser does not support those standards and you
need to upgrade. Visit WaSP
for a variety of options.
Paste #679
Posted by: BitByByte
Posted on: 2026-04-25 23:17:22
Age: 1 day ago
Views: 9
<input
name="ИМЯ ПОЛЯ"
type="text"
value="ИЗНАЧАЛЬНОЕ ЗНАЧЕНИЕ"
size="50"
style="color: gray;"
onfocus="clearIfDefault(this)"
onblur="restoreIfEmpty(this)"
>
<script>
var DEFAULT_TEXT = "ИЗНАЧАЛЬНОЕ ЗНАЧЕНИЕ";
function clearIfDefault(el) {
if (el.value == DEFAULT_TEXT) {
el.value = '';
el.style.color = 'black';
}
}
function restoreIfEmpty(el) {
if (el.value == '' || el.value == null) {
el.value = DEFAULT_TEXT;
el.style.color = 'gray';
}
}
</script>
Download raw |
Create new paste