|
Posted by nice.guy.nige on 12/16/06 15:46
While the city slept, Olli Mδntyranta (ollimax@gmail.com) feverishly
typed...
> sally jo wrote:
>> What is the code that you use to put words int he input box that
>> disappear when the user starts typing??
[...]
> function ClearText(){
> document.theBigForm.theField.value = "";
> }
[...]
The only problem with this code is that it will clear the textbox everytime
it is clicked on. Say for example I put some text in there, carry on with
the form, then notice I've made a typo in that field. I click on it to
change it and voila! Everything I typed before has vanished!
Maybe something like;
<script type="text/javascript">
<!-- Hide
var firstTime = true;
function clearText()
{
if(firstTime) {
document.theBigForm.theField.value = "";
firstTime = false;
}
}
// Dunhindin -->
</script>
I've not put that to the test mind, and it is a while since I did any JS...
Cheers,
Nige
--
Nigel Moss http://www.nigenet.org.uk
Mail address will bounce. nigel@DOG.nigenet.org.uk | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"
[Back to original message]
|