Click to See Complete Forum and Search --> : Form Effect
BOB101
02-17-2006, 09:17 PM
Hi,
What script can I use that, when a text field is click on, the value text disappears and when someone clicks put of the text field, the value text comes back?
Thanks,
BOB101
The Little Guy
02-17-2006, 10:20 PM
I can't find one that make it reapper after you click some where else and it comes back, but this will show text until you click on the feild. Here is an example: http://dumbells.t35.com/hunter/cluehunter.php
There is 3 parts to this code, The JavaScript (within the head):
<SCRIPT type="JavaScript">
<!-- Begin
function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
}
}
}
}
// End -->
</script>
The Body:
<body OnLoad="placeFocus()">
And the Text Feild:
<input name='answer' value='Type Answer Here!' onfocus='if(this.value=="Type Answer Here!")this.value="";' type='text'>
ray326
02-17-2006, 11:55 PM
Why do you want the old text to come back other than the fun of pissing off your visitors?