You can make that easier to implement by attaching the event handler with
script, eg say you had a form like this
<input type="text" name="a" value="box a">
<input type="text" name="b" value="box b">
<input type="text" name="c" value="box c">
then a script like this will clear the text box and restore the default
message onblur if nothing's typed in
<script>
function setForm(){
var a = document.forms[0].elements;
for(i=0;i<a.length;i++){if(a
.type=='text'){
a.onfocus = function(){this.value='';}
a.onblur = function(){if(!this.value)this.value=this.defaultValue;}}}}
window.onload=setForm;
</script>
--
Cheers,
Jon
Microsoft MVP
Murray said:
Here's a slick way -
<input type="text" name="n" value="Your message"
onFocus="if(this.value=='Your message')this.value='';">
This field will ONLY clear if it contains "Your message" and you click
in it (give it focus), otherwise it stays filled in.
--
Murray
I want to write a function to clear any text box on any page.
How could I change this specific function (that has a form name) into
something that can take the form name in a parameter?
function erase(txtInput){
frmName.all(txtInput).value = '';
}
Thanks!
mgm